linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] add runtime hotplug state control
@ 2026-01-14 23:50 Gregory Price
  2026-01-14 23:50 ` [PATCH v2 1/5] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Gregory Price @ 2026-01-14 23:50 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-cxl, nvdimm, linux-kernel, virtualization, kernel-team,
	dan.j.williams, vishal.l.verma, dave.jiang, david, mst, jasowang,
	xuanzhuo, eperezma, osalvador, akpm

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



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH] memory-tiers: multi-definition fixup
@ 2025-11-13 14:58 Gregory Price
  2026-01-15  2:38 ` [PATCH] dax/kmem: add build config for protected dax memory blocks Gregory Price
  0 siblings, 1 reply; 8+ messages in thread
From: Gregory Price @ 2025-11-13 14:58 UTC (permalink / raw)
  To: linux-mm; +Cc: kernel-team, linux-kernel

mt_set_node_type should be static

Signed-off-by: Gregory Price <gourry@gourry.net>
---
 include/linux/memory-tiers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
index 59443cbfaec3..aed9dc9e0c82 100644
--- a/include/linux/memory-tiers.h
+++ b/include/linux/memory-tiers.h
@@ -194,7 +194,7 @@ static inline void mt_put_memory_types(struct list_head *memory_types)
 {
 }
 
-int mt_set_node_type(int node, int type)
+static int mt_set_node_type(int node, int type)
 {
 	return 0;
 }
-- 
2.51.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-15  2:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-14 23:50 [PATCH v2 0/5] add runtime hotplug state control Gregory Price
2026-01-14 23:50 ` [PATCH v2 1/5] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-01-14 23:50 ` [PATCH v2 2/5] mm/memory_hotplug: add 'online_type' argument to add_memory_driver_managed Gregory Price
2026-01-14 23:50 ` [PATCH v2 3/5] dax/kmem: extract hotplug/hotremove helper functions Gregory Price
2026-01-14 23:50 ` [PATCH v2 4/5] dax/kmem: add sysfs interface for runtime hotplug state control Gregory Price
2026-01-14 23:50 ` [PATCH v2 5/5] dax/kmem: add memory notifier to block external state changes Gregory Price
2026-01-15  2:42   ` [PATCH] dax/kmem: add build config for protected dax memory blocks Gregory Price
  -- strict thread matches above, loose matches on Subject: below --
2025-11-13 14:58 [PATCH] memory-tiers: multi-definition fixup Gregory Price
2026-01-15  2:38 ` [PATCH] dax/kmem: add build config for protected dax memory blocks Gregory Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox