aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memory_hotplug.h
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2016-03-15 17:56:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commit31bc3858ea3ebcc3157b3f5f0e624c5962f5a7a6 (patch)
tree85b88976d85135ad518de3aa47cfef6e826d3917 /include/linux/memory_hotplug.h
parent9cb65bc3b1114004e2ccee5939031325c7bf16e8 (diff)
memory-hotplug: add automatic onlining policy for the newly added memory
Currently, all newly added memory blocks remain in 'offline' state unless someone onlines them, some linux distributions carry special udev rules like: SUBSYSTEM=="memory", ACTION=="add", ATTR{state}=="offline", ATTR{state}="online" to make this happen automatically. This is not a great solution for virtual machines where memory hotplug is being used to address high memory pressure situations as such onlining is slow and a userspace process doing this (udev) has a chance of being killed by the OOM killer as it will probably require to allocate some memory. Introduce default policy for the newly added memory blocks in /sys/devices/system/memory/auto_online_blocks file with two possible values: "offline" which preserves the current behavior and "online" which causes all newly added memory blocks to go online as soon as they're added. The default is "offline". Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Daniel Kiper <daniel.kiper@oracle.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Tang Chen <tangchen@cn.fujitsu.com> Cc: David Vrabel <david.vrabel@citrix.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Xishi Qiu <qiuxishi@huawei.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memory_hotplug.h')
-rw-r--r--include/linux/memory_hotplug.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 43405992d027..769d76870550 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -99,6 +99,8 @@ extern void __online_page_free(struct page *page);
99 99
100extern int try_online_node(int nid); 100extern int try_online_node(int nid);
101 101
102extern bool memhp_auto_online;
103
102#ifdef CONFIG_MEMORY_HOTREMOVE 104#ifdef CONFIG_MEMORY_HOTREMOVE
103extern bool is_pageblock_removable_nolock(struct page *page); 105extern bool is_pageblock_removable_nolock(struct page *page);
104extern int arch_remove_memory(u64 start, u64 size); 106extern int arch_remove_memory(u64 start, u64 size);
@@ -267,7 +269,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
267extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 269extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
268 void *arg, int (*func)(struct memory_block *, void *)); 270 void *arg, int (*func)(struct memory_block *, void *));
269extern int add_memory(int nid, u64 start, u64 size); 271extern int add_memory(int nid, u64 start, u64 size);
270extern int add_memory_resource(int nid, struct resource *resource); 272extern int add_memory_resource(int nid, struct resource *resource, bool online);
271extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default, 273extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default,
272 bool for_device); 274 bool for_device);
273extern int arch_add_memory(int nid, u64 start, u64 size, bool for_device); 275extern int arch_add_memory(int nid, u64 start, u64 size, bool for_device);