memory-hotplug: add automatic onlining policy for the newly added memory
authorVitaly Kuznetsov <[email protected]>
Tue, 15 Mar 2016 21:56:48 +0000 (14:56 -0700)
committerLinus Torvalds <[email protected]>
Tue, 15 Mar 2016 23:55:16 +0000 (16:55 -0700)
commit31bc3858ea3ebcc3157b3f5f0e624c5962f5a7a6
tree85b88976d85135ad518de3aa47cfef6e826d3917
parent9cb65bc3b1114004e2ccee5939031325c7bf16e8
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 <[email protected]>
Reviewed-by: Daniel Kiper <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Daniel Kiper <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Tang Chen <[email protected]>
Cc: David Vrabel <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Xishi Qiu <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Documentation/memory-hotplug.txt
drivers/base/memory.c
drivers/xen/balloon.c
include/linux/memory.h
include/linux/memory_hotplug.h
mm/memory_hotplug.c