aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2014-01-21 18:49:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:45 -0500
commit55ac590c2fadad785d60dd70c12d62823bc2cd39 (patch)
tree0b373b4943087706f8e0bee973d61d0bf24687df /include
parenta0acda917284183f9b71e2d08b0aa0aea722b321 (diff)
memblock, mem_hotplug: make memblock skip hotpluggable regions if needed
Linux kernel cannot migrate pages used by the kernel. As a result, hotpluggable memory used by the kernel won't be able to be hot-removed. To solve this problem, the basic idea is to prevent memblock from allocating hotpluggable memory for the kernel at early time, and arrange all hotpluggable memory in ACPI SRAT(System Resource Affinity Table) as ZONE_MOVABLE when initializing zones. In the previous patches, we have marked hotpluggable memory regions with MEMBLOCK_HOTPLUG flag in memblock.memory. In this patch, we make memblock skip these hotpluggable memory regions in the default top-down allocation function if movable_node boot option is specified. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "Rafael J . Wysocki" <rjw@sisk.pl> Cc: Chen Tang <imtangchen@gmail.com> Cc: Gong Chen <gong.chen@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiang Liu <jiang.liu@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Len Brown <lenb@kernel.org> Cc: Liu Jiang <jiang.liu@huawei.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Taku Izumi <izumi.taku@jp.fujitsu.com> Cc: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Thomas Renninger <trenn@suse.de> Cc: Toshi Kani <toshi.kani@hp.com> Cc: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/memblock.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 97480d392e40..2f52c8c492bd 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -47,6 +47,10 @@ struct memblock {
47 47
48extern struct memblock memblock; 48extern struct memblock memblock;
49extern int memblock_debug; 49extern int memblock_debug;
50#ifdef CONFIG_MOVABLE_NODE
51/* If movable_node boot option specified */
52extern bool movable_node_enabled;
53#endif /* CONFIG_MOVABLE_NODE */
50 54
51#define memblock_dbg(fmt, ...) \ 55#define memblock_dbg(fmt, ...) \
52 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 56 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
@@ -65,6 +69,26 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
65void memblock_trim_memory(phys_addr_t align); 69void memblock_trim_memory(phys_addr_t align);
66int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); 70int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
67int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); 71int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
72#ifdef CONFIG_MOVABLE_NODE
73static inline bool memblock_is_hotpluggable(struct memblock_region *m)
74{
75 return m->flags & MEMBLOCK_HOTPLUG;
76}
77
78static inline bool movable_node_is_enabled(void)
79{
80 return movable_node_enabled;
81}
82#else
83static inline bool memblock_is_hotpluggable(struct memblock_region *m)
84{
85 return false;
86}
87static inline bool movable_node_is_enabled(void)
88{
89 return false;
90}
91#endif
68 92
69#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 93#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
70int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, 94int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,