From: Sumanth Korikkar <sumanthk@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>
Cc: linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 1/4] mm/memory_hotplug: Add interface for runtime (de)configuration of memory
Date: Tue, 3 Dec 2024 15:33:08 +0100 [thread overview]
Message-ID: <Z08WpCxt4lsIsjcN@li-2b55cdcc-350b-11b2-a85c-a78bff51fc11.ibm.com> (raw)
In-Reply-To: <3151b9a0-3e96-4820-b6af-9f9ec4996ee1@redhat.com>
On Mon, Dec 02, 2024 at 05:55:19PM +0100, David Hildenbrand wrote:
> Hi!
>
> Not completely what I had in mind, especially not that we need something
> that generic without any indication of ranges :)
>
> In general, the flow is as follows:
>
> 1) Driver detects memory and adds it
> 2) Something auto-onlines that memory (e.g., udev rule)
>
> For dax/kmem, 1) can be controlled using devdax, and usually it also tries
> to take care of 2).
>
> s390x standby storage really is the weird thing here, because it does 1) and
> doesn't want 2). It shouldn't do 1) until a user wants to make use of
> standby memory.
Hi David,
The current rfc design doesnt do 1) until user initiates it.
The current rfc design considers the fact that there cannot be memory
holes, when there is a availability of standby memory. (which holds true
for both lpars and zvms)
With number of online and standby memory ranges count
(max_configurable), prototype lsmem/chmem could determine memory ranges
which are not yet configured
i.e. (configurable_memory = max_configurable - online ranges from sysfs
/sys/devices/system/memory/memory*).
Example prototype implementation of lsmem/chmem looks like:
./lsmem -o RANGE,SIZE,STATE,BLOCK,ALTMAP
RANGE SIZE STATE BLOCK ALTMAP
0x0000000000000000-0x00000002ffffffff 12G online 0-95 0
0x0000000300000000-0x00000003ffffffff 4G deconfigured 96-127 -
# Configure range with altmap
./chmem -c 0x0000000300000000-0x00000003ffffffff -a
./lsmem -o RANGE,SIZE,STATE,BLOCK,ALTMAP
RANGE SIZE STATE BLOCK ALTMAP
0x0000000000000000-0x00000002ffffffff 12G online 0-95 0
0x0000000300000000-0x00000003ffffffff 4G offline 96-127 1
# Online range
./chmem -e 0x0000000300000000-0x00000003ffffffff &&
./lsmem -o RANGE,SIZE,STATE,BLOCK,ALTMAP
RANGE SIZE STATE BLOCK ALTMAP
0x0000000000000000-0x00000002ffffffff 12G online 0-95 0
0x0000000300000000-0x00000003ffffffff 4G online 96-127 1
Memory block size: 128M
Total online memory: 16G
Total offline memory: 0B
Total deconfigured: 0B
# offline range
./chmem -d 0x0000000300000000-0x00000003ffffffff &&
./lsmem -o RANGE,SIZE,STATE,BLOCK,ALTMAP
RANGE SIZE STATE BLOCK ALTMAP
0x0000000000000000-0x00000002ffffffff 12G online 0-95 0
0x0000000300000000-0x00000003ffffffff 4G offline 96-127 1
Memory block size: 128M
Total online memory: 12G
Total offline memory: 4G
Total deconfigured: 0B
# Defconfigure range.
./chmem -g 0x0000000300000000-0x00000003ffffffff &&
./lsmem -o RANGE,SIZE,STATE,BLOCK,ALTMAP
RANGE SIZE STATE BLOCK ALTMAP
0x0000000000000000-0x00000002ffffffff 12G online 0-95 0
0x0000000300000000-0x00000003ffffffff 4G deconfigured 96-127 -
Memory block size: 128M
Total online memory: 12G
Total offline memory: 0B
Total deconfigured: 4G
The user can still determine the available memory ranges and make them
configurable using tools like lsmem or chmem with this approach atleast
on s390 with this approach.
> My thinking was that s390x would expose the standby memory ranges somewhere
> arch specific in sysfs. From there, one could simply trigger the adding
> (maybe specifying e.g, memmap_on_memory) of selected ranges.
As far as I understand, sysfs interface limits the size of the buffer
used in show() to 4kb. When there are huge number of standby memory
ranges, wouldnt it be an issue to display everything in one attribute?
Or use sysfs binary attributes to overcome the limitation?
Please correct me, If I am wrong.
Questions:
1. If we go ahead with this sysfs interface approach to list all standby
memory ranges, could the list be made available via
/sys/devices/system/memory/configurable_memlist? This could be helpful,
as /sys/devices/system/memory/configure_memory performs architecture
independent checks and could also be useful for other architectures in
the future.
2. Whether the new interface should also be compatible with lsmem/chmem?
3. OR can we have a s390 specific path (eg:
/sys/firmware/memory/standy_range) to list all standby memory range
which are in deconfigured state and also use the current design
(max_configurable) to make it easier for lsmem/chmem tool to detect
these standby memory ranges?
> To disable standby memory, one would first offline the memory to then
> trigger removal using the arch specific interface. It is very similar to
> dax/kmem's way of handling offline+removal.
ok
> Now I wonder if dax/kmem could be (ab)used on s390x for standby storage.
> Likely a simple sysfs interface could be easier to implement.
I havent checked dax/kmem in detail yet. I will look into it.
Thank you
next prev parent reply other threads:[~2024-12-03 14:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 8:27 [RFC PATCH 0/4] Support dynamic " Sumanth Korikkar
2024-12-02 8:27 ` [RFC PATCH 1/4] mm/memory_hotplug: Add interface for runtime " Sumanth Korikkar
2024-12-02 16:55 ` David Hildenbrand
2024-12-03 14:33 ` Sumanth Korikkar [this message]
2024-12-20 15:53 ` David Hildenbrand
2025-05-20 13:06 ` Sumanth Korikkar
2025-05-20 17:55 ` David Hildenbrand
2025-05-21 10:34 ` Sumanth Korikkar
2025-05-21 12:33 ` David Hildenbrand
2025-05-21 14:21 ` Heiko Carstens
2025-05-21 14:25 ` David Hildenbrand
2025-05-21 14:24 ` Sumanth Korikkar
2024-12-02 8:27 ` [RFC PATCH 2/4] mm/memory_hotplug: Add memory block altmap sysfs attribute Sumanth Korikkar
2024-12-02 8:27 ` [RFC PATCH 3/4] mm/memory_hotplug: Add max_configurable sysfs read attribute Sumanth Korikkar
2024-12-02 8:27 ` [RFC PATCH 4/4] s390/sclp: Add support for dynamic (de)configuration of memory Sumanth Korikkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z08WpCxt4lsIsjcN@li-2b55cdcc-350b-11b2-a85c-a78bff51fc11.ibm.com \
--to=sumanthk@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox