Commit 005fd4bb authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner

mm/page_alloc: Convert to hotplug state machine

Install the callbacks via the state machine.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161103145021.28528-7-bigeasy@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent d544abd5
...@@ -35,6 +35,7 @@ enum cpuhp_state { ...@@ -35,6 +35,7 @@ enum cpuhp_state {
CPUHP_MM_MEMCQ_DEAD, CPUHP_MM_MEMCQ_DEAD,
CPUHP_PERCPU_CNT_DEAD, CPUHP_PERCPU_CNT_DEAD,
CPUHP_RADIX_DEAD, CPUHP_RADIX_DEAD,
CPUHP_PAGE_ALLOC_DEAD,
CPUHP_WORKQUEUE_PREP, CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE, CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE, CPUHP_HRTIMERS_PREPARE,
......
...@@ -6491,38 +6491,39 @@ void __init free_area_init(unsigned long *zones_size) ...@@ -6491,38 +6491,39 @@ void __init free_area_init(unsigned long *zones_size)
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL); __pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
} }
static int page_alloc_cpu_notify(struct notifier_block *self, static int page_alloc_cpu_dead(unsigned int cpu)
unsigned long action, void *hcpu)
{ {
int cpu = (unsigned long)hcpu;
if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { lru_add_drain_cpu(cpu);
lru_add_drain_cpu(cpu); drain_pages(cpu);
drain_pages(cpu);
/* /*
* Spill the event counters of the dead processor * Spill the event counters of the dead processor
* into the current processors event counters. * into the current processors event counters.
* This artificially elevates the count of the current * This artificially elevates the count of the current
* processor. * processor.
*/ */
vm_events_fold_cpu(cpu); vm_events_fold_cpu(cpu);
/* /*
* Zero the differential counters of the dead processor * Zero the differential counters of the dead processor
* so that the vm statistics are consistent. * so that the vm statistics are consistent.
* *
* This is only okay since the processor is dead and cannot * This is only okay since the processor is dead and cannot
* race with what we are doing. * race with what we are doing.
*/ */
cpu_vm_stats_fold(cpu); cpu_vm_stats_fold(cpu);
} return 0;
return NOTIFY_OK;
} }
void __init page_alloc_init(void) void __init page_alloc_init(void)
{ {
hotcpu_notifier(page_alloc_cpu_notify, 0); int ret;
ret = cpuhp_setup_state_nocalls(CPUHP_PAGE_ALLOC_DEAD,
"mm/page_alloc:dead", NULL,
page_alloc_cpu_dead);
WARN_ON(ret < 0);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment