Documentation/ABI/testing/sysfs-bus-dax | 17 + drivers/dax/kmem.c | 577 ++++++++++++++++++++---- drivers/virtio/virtio_mem.c | 3 +- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 35 +- 5 files changed, 528 insertions(+), 106 deletions(-)
The dax kmem driver currently onlines memory automatically during
probe using the system's default online policy but provides no way
to control or query the entire region state at runtime.
This series adds a sysfs interface to control DAX kmem memory
hotplug state, and refactors the memory_hotplug paths to make it
possible for drivers to request an online type at hotplug time.
Problem
=======
Once dax_kmem onlines memory during probe, there's no mechanism in
the dax driver to:
- Query the current state of the memory region
- Offline and hot-remove memory blocks atomically
- Control online type (ZONE_NORMAL vs ZONE_MOVABLE)
- Prevent external interference with driver-managed memory state
This forces users (such as ndctl) to toggle individual memory blocks
prior to unbinding the dax device, and has lead to some race conditions
between competing hotplug policies.
Solution
========
This series introduces a 'hotplug' sysfs attribute for dax_kmem devices
that allows userspace to control and query memory region state:
/sys/bus/dax/devices/daxN.M/hotplug
Supported states:
- "unplug": memory is offline and blocks are not present
- "online": memory is online as normal system RAM
- "online_movable": memory is online in ZONE_MOVABLE
A memory notifier prevents external operations (auto-online policies,
direct sysfs manipulation) from changing memory state, ensuring the
driver maintains consistent state tracking.
Patches
=======
Patches 1-2 prepare mm/memory_hotplug to allow callers to specify an
explicit online type rather than implicitly using the system default.
Patch 3 refactors dax_kmem to extract hotplug/hotremove helpers,
preparing for the sysfs interface.
Patch 4 adds the 'hotplug' sysfs interface for runtime state control.
Patch 5 adds a memory notifier to prevent external state changes and
maintain consistency between the sysfs interface and actual memory
block state.
Gregory Price (5):
mm/memory_hotplug: pass online_type to online_memory_block() via arg
mm/memory_hotplug: add 'online_type' argument to
add_memory_driver_managed
dax/kmem: extract hotplug/hotremove helper functions
dax/kmem: add sysfs interface for runtime hotplug state control
dax/kmem: add memory notifier to block external state changes
Documentation/ABI/testing/sysfs-bus-dax | 17 +
drivers/dax/kmem.c | 577 ++++++++++++++++++++----
drivers/virtio/virtio_mem.c | 3 +-
include/linux/memory_hotplug.h | 2 +-
mm/memory_hotplug.c | 35 +-
5 files changed, 528 insertions(+), 106 deletions(-)
--
2.52.0
On 1/15/26 00:50, Gregory Price wrote: > The dax kmem driver currently onlines memory automatically during > probe using the system's default online policy but provides no way > to control or query the entire region state at runtime. > > This series adds a sysfs interface to control DAX kmem memory > hotplug state, and refactors the memory_hotplug paths to make it > possible for drivers to request an online type at hotplug time. Gregory, slow down a bit please. I haven't even had the chance to go through your replies on v1. I'm currently on PTO and don't have the full day to review stuff :) And boy oh boy, do I have a lot of stuff in my inbox. Maybe given this is the second time the patch subject is suboptimal is another sign to slow down a bit? :P * Subject: [PATCH 0/8] dax/kmem: add runtime hotplug state control * [PATCH v2 0/5] add runtime hotplug state control I guess it should be "[PATCH v2 0/5] dax/kmem:add runtime hotplug state control" -- Cheers David
On Thu, Jan 15, 2026 at 06:26:21PM +0100, David Hildenbrand (Red Hat) wrote: > On 1/15/26 00:50, Gregory Price wrote: > > The dax kmem driver currently onlines memory automatically during > > probe using the system's default online policy but provides no way > > to control or query the entire region state at runtime. > > > > This series adds a sysfs interface to control DAX kmem memory > > hotplug state, and refactors the memory_hotplug paths to make it > > possible for drivers to request an online type at hotplug time. > > Gregory, slow down a bit please. I haven't even had the chance to go through > your replies on v1. > Sorry, i realized your feedback on v1 showed there was just too much complexity. I would ignore v1 entirely at this point, this version is significantly simpler. > I'm currently on PTO and don't have the full day to review stuff :) And boy > oh boy, do I have a lot of stuff in my inbox. > > Maybe given this is the second time the patch subject is suboptimal is > another sign to slow down a bit? :P > Apologies, and I will let this one sit. ~Gregory
On 1/15/26 18:42, Gregory Price wrote: > On Thu, Jan 15, 2026 at 06:26:21PM +0100, David Hildenbrand (Red Hat) wrote: >> On 1/15/26 00:50, Gregory Price wrote: >>> The dax kmem driver currently onlines memory automatically during >>> probe using the system's default online policy but provides no way >>> to control or query the entire region state at runtime. >>> >>> This series adds a sysfs interface to control DAX kmem memory >>> hotplug state, and refactors the memory_hotplug paths to make it >>> possible for drivers to request an online type at hotplug time. >> >> Gregory, slow down a bit please. I haven't even had the chance to go through >> your replies on v1. >> > > Sorry, i realized your feedback on v1 showed there was just too much > complexity. I would ignore v1 entirely at this point, this version is > significantly simpler. Fair enough, I can see that the complexity here is likely reduced (less patches! ). > >> I'm currently on PTO and don't have the full day to review stuff :) And boy >> oh boy, do I have a lot of stuff in my inbox. >> >> Maybe given this is the second time the patch subject is suboptimal is >> another sign to slow down a bit? :P >> > > Apologies, and I will let this one sit. Yes, at least wait until I had the chance to reply :) -- Cheers David
© 2016 - 2026 Red Hat, Inc.