]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cpu-hotplug,memory-hotplug: clear cpu_to_node() when offlining the node
authorWen Congyang <wency@cn.fujitsu.com>
Thu, 7 Feb 2013 01:26:34 +0000 (12:26 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:46:31 +0000 (16:46 +1100)
When the node is offlined, there is no memory/cpu on the node.  If a sleep
task runs on a cpu of this node, it will be migrated to the cpu on the
other node.  So we can clear cpu-to-node mapping.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory_hotplug.c

index d4a9820edfc7a013f979e3a60aa8a5717c6f30b8..0653b97988fc717caae2ff79df8611430790beb6 100644 (file)
@@ -1705,6 +1705,34 @@ static int check_cpu_on_node(void *data)
        return 0;
 }
 
+static void unmap_cpu_on_node(void *data)
+{
+#ifdef CONFIG_ACPI_NUMA
+       struct pglist_data *pgdat = data;
+       int cpu;
+
+       for_each_possible_cpu(cpu)
+               if (cpu_to_node(cpu) == pgdat->node_id)
+                       numa_clear_node(cpu);
+#endif
+}
+
+static int check_and_unmap_cpu_on_node(void *data)
+{
+       int ret = check_cpu_on_node(data);
+
+       if (ret)
+               return ret;
+
+       /*
+        * the node will be offlined when we come here, so we can clear
+        * the cpu_to_node() now.
+        */
+
+       unmap_cpu_on_node(data);
+       return 0;
+}
+
 /* offline the node if all memory sections of this node are removed */
 void try_offline_node(int nid)
 {
@@ -1731,7 +1759,7 @@ void try_offline_node(int nid)
                return;
        }
 
-       if (stop_machine(check_cpu_on_node, pgdat, NULL))
+       if (stop_machine(check_and_unmap_cpu_on_node, pgdat, NULL))
                return;
 
        /*