Skip to content

chmem/lsmem: dynamic (de)configuration of memory

Sumanth Korikkar util-linux 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 0 repliesNew
  2. v16 patches 6 repliesSuperseded

Changes in v2 from the cover letter

* lsmem:
* Use _PATH_SYS_MEMMAP_PARM instead of const char *path.
* Use N_()/_() in get_memmap_mode()/printf().
* Improve skip_memconfig_column().
* Check /sys/firmware/memory/memory0 existance before read_basic_info(). The latter can run after column setup. Doing so reduces ul_path_access(lsmem->sysmemconfig, F_OK, 'memory0') calls to just one.
* chmem:
* Rename chmem_memmap_on_memory_option_enabled() to chmem_memmap_enabled().
* Improve configure check in warn().
* Optimization in chmem_set_memmap_on_memory().
* Remove "\n" in warn().
* Add _() when printing info.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6lsmem: display global memmap on memory parametersys-utils/lsmem.1.adoc sys-utils/lsmem.c+31 -00 replies
2/6lsmem: add support to display dynamic (de)configuration of memorysys-utils/lsmem.c+95 -120 replies
3/6chmem: add support for dynamic (de)configuration of hotplug memorysys-utils/chmem.c+342 -290 replies
4/6chmem: add chmem documentation for dynamic (de)configuration of memorysys-utils/chmem.8.adoc+42 -50 replies
5/6lsmem: add doc for dynamic (de)configuration and memmap-on-memory supportsys-utils/lsmem.1.adoc+41 -30 replies
6/6lsmem,chmem: add configure/deconfigure bash completion optionsbash-completion/chmem bash-completion/lsmem+4 -10 replies

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchMaria Eisenhaendler
1/6
2/6
3/6
4/6R-b
5/6R-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] chmem/lsmem: dynamic (de)configuration of memory

Hi all,

Patchset extends chmem and lsmem with support for dynamically configuring and deconfiguring hotpluggable memory blocks on s390, including per-block memmap-on-memory handling.

On s390, the memmap-on-memory feature was
introduced to ensure that the struct page array (metadata) for hotpluggable standby memory can be allocated from the memory block itself. This allowed hot-add operations even under memory pressure, especially in systems with an imbalance between boot-time online memory and standby memory.

The original implementation had few limitations:
* All hotpluggable standby memory was added at boot, making blocks visible for online/offline operations earlier.
* The use of memmap-on-memory was global and static, decided at boot time. Either all standby blocks used it, or none of them did.
* memmap-on-memory choice could not be changed at runtime, limiting flexibility.

The s390 kernel (linux-next) ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory") no longer pre-adds all standby memory at boot. Instead, users must explicitly configure a block before it can be used for online/offline actions. At configuration time, users can dynamically decide whether to use optional memmap-on-memory for each memory block, where value of 1 allocates metadata (such as struct pages array) from the hotplug memory itself, enabling hot-add operations even under memory pressure. A value of 0 stores metadata in regular system memory and enables continuous physical memory across memory blocks.

Kernel changes for dynamic (de)configuration of memory (available on linux-next):
https://lore.kernel.org/all/[email protected]/
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/s390/char/sclp_mem.c

The kernel sysfs interface provides configuration and memmap-on-memory toggling:
echo 1 > /sys/firmware/memory/memoryX/config – configure block
echo 0 > /sys/firmware/memory/memoryX/config – deconfigure block echo 1 > /sys/firmware/memory/memoryX/memmap_on_memory – enable memmap-on-memory echo 0 > /sys/firmware/memory/memoryX/memmap_on_memory – disable memmap-on-memory

Patchset teaches chmem and lsmem to make use of these interfaces, mirroring existing online/offline semantics:

chmem -c 128M -m 1 : configure memory with memmap-on-memory chmem -g 128M : deconfigure memory
chmem -e 128M : configure (if supported by architecture) and online memory chmem -d 128M : offline and deconfigure memory (if supported by architecture)
lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY

memmap-on-memory can only be toggled when a block is in a deconfigured state, and is supported via the --configure option.

v2 (Thanks Karel):
* lsmem:
* Use _PATH_SYS_MEMMAP_PARM instead of const char *path.
* Use N_()/_() in get_memmap_mode()/printf().
* Improve skip_memconfig_column().
* Check /sys/firmware/memory/memory0 existance before read_basic_info(). The latter can run after column setup. Doing so reduces ul_path_access(lsmem->sysmemconfig, F_OK, 'memory0') calls to just one.
* chmem:
* Rename chmem_memmap_on_memory_option_enabled() to chmem_memmap_enabled().
* Improve configure check in warn().
* Optimization in chmem_set_memmap_on_memory().
* Remove "\n" in warn().
* Add _() when printing info.

Sumanth Korikkar (6):
lsmem: display global memmap on memory parameter
lsmem: add support to display dynamic (de)configuration of memory
chmem: add support for dynamic (de)configuration of hotplug memory
chmem: add chmem documentation for dynamic (de)configuration of memory
lsmem: add doc for dynamic (de)configuration and memmap-on-memory
support
lsmem,chmem: add configure/deconfigure bash completion options

 bash-completion/chmem  |   3 +
 bash-completion/lsmem  |   2 +-
 sys-utils/chmem.8.adoc |  47 +++++-
 sys-utils/chmem.c      | 371 +++++++++++++++++++++++++++++++++++++----
 sys-utils/lsmem.1.adoc |  46 ++++-
 sys-utils/lsmem.c      | 136 +++++++++++++--
 6 files changed, 555 insertions(+), 50 deletions(-)
Signature · 1 line
2.41.0