]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - kernel/cpu.c
cpu/mem hotplug: enable CPUs online before local memory online
[mv-sheeva.git] / kernel / cpu.c
index 545777574779da71ef8e3fcc3935e0e41fa266ca..a3fbcc0a0abc15976dc78423a985a6c522180c18 100644 (file)
@@ -326,6 +326,12 @@ out_notify:
 int __cpuinit cpu_up(unsigned int cpu)
 {
        int err = 0;
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+       int nid;
+       pg_data_t       *pgdat;
+#endif
+
        if (!cpu_possible(cpu)) {
                printk(KERN_ERR "can't online cpu %d because it is not "
                        "configured as may-hotadd at boot time\n", cpu);
@@ -336,6 +342,25 @@ int __cpuinit cpu_up(unsigned int cpu)
                return -EINVAL;
        }
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+       nid = cpu_to_node(cpu);
+       if (!node_online(nid)) {
+               err = mem_online_node(nid);
+               if (err)
+                       return err;
+       }
+
+       pgdat = NODE_DATA(nid);
+       if (!pgdat) {
+               printk(KERN_ERR
+                       "Can't online cpu %d due to NULL pgdat\n", cpu);
+               return -ENOMEM;
+       }
+
+       if (pgdat->node_zonelists->_zonerefs->zone == NULL)
+               build_all_zonelists();
+#endif
+
        cpu_maps_update_begin();
 
        if (cpu_hotplug_disabled) {