On 12/6/2024 9:10 AM, Alison Schofield wrote: > On Thu, Dec 05, 2024 at 12:14:56AM +0800, Li Ming wrote: >> If CONFIG_MEMORY_HOTREMOVE is disabled by kernel, memblocks will not be >> removed, so 'dax offline-memory all' will output below error logs: >> >> libdaxctl: offline_one_memblock: dax0.0: Failed to offline >> /sys/devices/system/node/node6/memory371/state: Invalid argument >> dax0.0: failed to offline memory: Invalid argument >> error offlining memory: Invalid argument >> offlined memory for 0 devices >> >> The log does not clearly show why the command failed. So checking if the >> target memblock is removable before offlining it by querying >> '/sys/devices/system/node/nodeX/memoryY/removable', then output specific >> logs if the memblock is unremovable, output will be: >> >> libdaxctl: offline_one_memblock: dax0.0: memory371 is unremovable >> dax0.0: failed to offline memory: Operation not supported >> error offlining memory: Operation not supported >> offlined memory for 0 devices >> > Hi Ming, > > This led me to catch up on movable and removable in DAX context. > Not all 'Movable' DAX memory is 'Removable' right? > > Would it be useful to add 'removable' to the daxctl list json: > > # daxctl list > [ > { > "chardev":"dax0.0", > "size":536870912, > "target_node":0, > "align":2097152, > "mode":"system-ram", > "online_memblocks":4, > "total_memblocks":4, > "movable":true > "removable":false <---- > } > ]
Hi Alison, After investigation, if there is no "movable" in dax list json, that means the kernel does not support MEMORY_HOTREMOVE. if there is a "movable" in dax list json, that means the kernel supports MEMORY_HOTREMOVE and the value of "movable" decides if memblocks can be offlined. So user cannot offline the memblocks if "movable" is false and "removable" is true. Feels like the "removable" field does not make much sense in kernel supporting MEMORY_HOTREMOVE case. user can use "movable" to check if memblocks can be offlined. do you think if it is still worth adding a "removable" in daxctl list json? Thanks Ming