On 1/14/26 09:51, 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 memory state at runtime. Users cannot change
the online type after probe, and there's no atomic way to offline and
remove memory blocks together.

Add a new 'hotplug' sysfs attribute that allows userspace to control
and query the memory state. The interface supports the following states:

   - "offline": memory is added but not online
   - "online": memory is online as normal system RAM
   - "online_movable": memory is online in ZONE_MOVABLE
   - "unplug": memory is offlined and removed

The initial state after probe uses MMOP_SYSTEM_DEFAULT to preserve
backwards compatibility - existing systems with auto-online policies
will continue to work as before.

The state machine enforces valid transitions:
   - From offline: can transition to online, online_movable, or unplug
   - From online/online_movable: can transition to offline or unplug
   - Cannot switch directly between online and online_movable

Do we have to support these transitions right from the start?

What are the use cases for adding memory as offline and then onlining it, and why do we have to support that through this interface?

It would be a lot simpler if we would only allow

>    - "offline": memory is added but not online
>    - "online": memory is online as normal system RAM
>    - "online_movable": memory is online in ZONE_MOVABLE
>    - "unplug": memory is offlined and removed

That is, transitioning from offline to online or vice versa fails with -ENOSUPP. User space can do that itself through sysfs and if there is ever a good use case we can extend this interface here to allow it.

Or is there a good use case that really requires this?

--
Cheers

David

Reply via email to