Skip to content

mm/memory_hotplug: make offline_and_remove_memory() timeout instead of failing on fatal signals

David Hildenbrand linux-mm lkml llvm oe-kbuild-all virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm/memory_hotplug: check for fatal signals only in offline_pages()mm/memory_hotplug.c+1 -13 replies
2/5virtio-mem: convert most offline_and_remove_memory() errors to -EBUSYdrivers/virtio/virtio_mem.c+9 -10 replies
3/5mm/memory_hotplug: make offline_and_remove_memory() timeout instead of failing on fatal signalsdrivers/virtio/virtio_mem.c include/linux/memory_hotplug.h mm/memory_hotplug.c+50 -46 replies
4/5virtio-mem: set the timeout for offline_and_remove_memory() to 10 secondsdrivers/virtio/virtio_mem.c+2 -20 replies
5/5virtio-mem: check if the config changed before (fake) offlining memorydrivers/virtio/virtio_mem.c+8 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/5] mm/memory_hotplug: make offline_and_remove_memory() timeout instead of failing on fatal signals

As raised by John Hubbard [1], offline_and_remove_memory() failing on fatal signals can be sub-optimal for out-of-tree drivers: dying user space might be the last one holding a device node open.

As that device node gets closed, the driver might unplug the device and trigger offline_and_remove_memory() to unplug previously hotplugged device memory. This, however, will fail reliably when fatal signals are pending on the dying process, turning the device unusable until the machine gets rebooted.

That can be optizied easily by ignoring fatal signals. In fact, checking for fatal signals in the case of offline_and_remove_memory() doesn't make too much sense; the check makes sense when offlining is triggered directly via sysfs. However, we actually do want a way to not end up stuck in offline_and_remove_memory() forever.

What offline_and_remove_memory() users actually want is fail after some given timeout and not care about fatal signals.

So let's implement that, optimizing virtio-mem along the way.

Cc Andrew Morton <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc John Hubbard <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Jason Wang <[email protected]>
Cc Xuan Zhuo <[email protected]>

[1] https://lkml.kernel.org/r/[email protected]

David Hildenbrand (5):
mm/memory_hotplug: check for fatal signals only in offline_pages()
virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY mm/memory_hotplug: make offline_and_remove_memory() timeout instead of
failing on fatal signals
virtio-mem: set the timeout for offline_and_remove_memory() to 10
seconds
virtio-mem: check if the config changed before (fake) offlining memory

 drivers/virtio/virtio_mem.c    | 22 +++++++++++++--
 include/linux/memory_hotplug.h |  2 +-
 mm/memory_hotplug.c            | 50 ++++++++++++++++++++++++++++++++--
 3 files changed, 68 insertions(+), 6 deletions(-)

base-commit: 6995e2de6891c724bfeb2db33d7b87775f913ad1

Signature · 1 line
2.40.1