Commit 90b30cdc1d87450e2ae89c8f8a29102dc2c1992e

Authored by Wen Congyang
Committed by Linus Torvalds
1 parent c4c6052464

memory-hotplug: export the function try_offline_node()

try_offline_node() will be needed in the tristate
drivers/acpi/processor_driver.c.

The node will be offlined when all memory/cpu on the node have been
hotremoved.  So we need the function try_offline_node() in cpu-hotplug
path.

If the memory-hotplug is disabled, and cpu-hotplug is enabled

1. no memory no the node
   we don't online the node, and cpu's node is the nearest node.

2. the node contains some memory
   the node has been onlined, and cpu's node is still needed
   to migrate the sleep task on the cpu to the same node.

So we do nothing in try_offline_node() in this case.

[rientjes@google.com: export the function try_offline_node() fix]
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>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 5 additions and 1 deletions Side-by-side Diff

include/linux/memory_hotplug.h
... ... @@ -233,6 +233,7 @@
233 233 #ifdef CONFIG_MEMORY_HOTREMOVE
234 234  
235 235 extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
  236 +extern void try_offline_node(int nid);
236 237  
237 238 #else
238 239 static inline int is_mem_section_removable(unsigned long pfn,
... ... @@ -240,6 +241,8 @@
240 241 {
241 242 return 0;
242 243 }
  244 +
  245 +static inline void try_offline_node(int nid) {}
243 246 #endif /* CONFIG_MEMORY_HOTREMOVE */
244 247  
245 248 extern int mem_online_node(int nid);
... ... @@ -1706,7 +1706,7 @@
1706 1706 }
1707 1707  
1708 1708 /* offline the node if all memory sections of this node are removed */
1709   -static void try_offline_node(int nid)
  1709 +void try_offline_node(int nid)
1710 1710 {
1711 1711 pg_data_t *pgdat = NODE_DATA(nid);
1712 1712 unsigned long start_pfn = pgdat->node_start_pfn;
... ... @@ -1762,6 +1762,7 @@
1762 1762 */
1763 1763 memset(pgdat, 0, sizeof(*pgdat));
1764 1764 }
  1765 +EXPORT_SYMBOL(try_offline_node);
1765 1766  
1766 1767 int __ref remove_memory(int nid, u64 start, u64 size)
1767 1768 {