Commit 90b30cdc authored by Wen Congyang's avatar Wen Congyang Committed by Linus Torvalds

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: default avatarWen Congyang <wency@cn.fujitsu.com>
Signed-off-by: default avatarTang 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: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c4c60524
...@@ -233,6 +233,7 @@ static inline void unlock_memory_hotplug(void) {} ...@@ -233,6 +233,7 @@ static inline void unlock_memory_hotplug(void) {}
#ifdef CONFIG_MEMORY_HOTREMOVE #ifdef CONFIG_MEMORY_HOTREMOVE
extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
extern void try_offline_node(int nid);
#else #else
static inline int is_mem_section_removable(unsigned long pfn, static inline int is_mem_section_removable(unsigned long pfn,
...@@ -240,6 +241,8 @@ static inline int is_mem_section_removable(unsigned long pfn, ...@@ -240,6 +241,8 @@ static inline int is_mem_section_removable(unsigned long pfn,
{ {
return 0; return 0;
} }
static inline void try_offline_node(int nid) {}
#endif /* CONFIG_MEMORY_HOTREMOVE */ #endif /* CONFIG_MEMORY_HOTREMOVE */
extern int mem_online_node(int nid); extern int mem_online_node(int nid);
......
...@@ -1706,7 +1706,7 @@ static int check_cpu_on_node(void *data) ...@@ -1706,7 +1706,7 @@ static int check_cpu_on_node(void *data)
} }
/* offline the node if all memory sections of this node are removed */ /* offline the node if all memory sections of this node are removed */
static void try_offline_node(int nid) void try_offline_node(int nid)
{ {
pg_data_t *pgdat = NODE_DATA(nid); pg_data_t *pgdat = NODE_DATA(nid);
unsigned long start_pfn = pgdat->node_start_pfn; unsigned long start_pfn = pgdat->node_start_pfn;
...@@ -1762,6 +1762,7 @@ static void try_offline_node(int nid) ...@@ -1762,6 +1762,7 @@ static void try_offline_node(int nid)
*/ */
memset(pgdat, 0, sizeof(*pgdat)); memset(pgdat, 0, sizeof(*pgdat));
} }
EXPORT_SYMBOL(try_offline_node);
int __ref remove_memory(int nid, u64 start, u64 size) int __ref remove_memory(int nid, u64 start, u64 size)
{ {
......
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