aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2013-11-12 18:07:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:04 -0500
commit01b0f19707c51ef247404e6af1d4a97a11ba34f7 (patch)
tree0e266339d6a644acdb7300c1a6bbad4106c68d57 /kernel
parent309d0b3917387b48d1fa1a15aa6762de489c9123 (diff)
cpu/mem hotplug: add try_online_node() for cpu_up()
cpu_up() has #ifdef CONFIG_MEMORY_HOTPLUG code blocks, which call mem_online_node() to put its node online if offlined and then call build_all_zonelists() to initialize the zone list. These steps are specific to memory hotplug, and should be managed in mm/memory_hotplug.c. lock_memory_hotplug() should also be held for the whole steps. For this reason, this patch replaces mem_online_node() with try_online_node(), which performs the whole steps with lock_memory_hotplug() held. try_online_node() is named after try_offline_node() as they have similar purpose. There is no functional change in this patch. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 63aa50d7ce1e..973d034acf84 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -437,11 +437,6 @@ int cpu_up(unsigned int cpu)
437{ 437{
438 int err = 0; 438 int err = 0;
439 439
440#ifdef CONFIG_MEMORY_HOTPLUG
441 int nid;
442 pg_data_t *pgdat;
443#endif
444
445 if (!cpu_possible(cpu)) { 440 if (!cpu_possible(cpu)) {
446 printk(KERN_ERR "can't online cpu %d because it is not " 441 printk(KERN_ERR "can't online cpu %d because it is not "
447 "configured as may-hotadd at boot time\n", cpu); 442 "configured as may-hotadd at boot time\n", cpu);
@@ -452,27 +447,9 @@ int cpu_up(unsigned int cpu)
452 return -EINVAL; 447 return -EINVAL;
453 } 448 }
454 449
455#ifdef CONFIG_MEMORY_HOTPLUG 450 err = try_online_node(cpu_to_node(cpu));
456 nid = cpu_to_node(cpu); 451 if (err)
457 if (!node_online(nid)) { 452 return err;
458 err = mem_online_node(nid);
459 if (err)
460 return err;
461 }
462
463 pgdat = NODE_DATA(nid);
464 if (!pgdat) {
465 printk(KERN_ERR
466 "Can't online cpu %d due to NULL pgdat\n", cpu);
467 return -ENOMEM;
468 }
469
470 if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
471 mutex_lock(&zonelists_mutex);
472 build_all_zonelists(NULL, NULL);
473 mutex_unlock(&zonelists_mutex);
474 }
475#endif
476 453
477 cpu_maps_update_begin(); 454 cpu_maps_update_begin();
478 455