If you have disabled automatic memory onlining, newly added memory blocks, such as those from a hot-plugged CXL device, remain offline by default. You can manually online these memory blocks by using the sysfs interface.
Before you begin
- You have root privileges on your system.
Procedure
-
Identify the offline memory block identifier using the
lsmem command:
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000000000000-0x000000007fffffff 2G online yes 0-1
0x0000000100000000-0x000000087fffffff 30G online yes 4-33
0x0000000880000000-0x00000008ffffffff 2G offline 34-41
Memory block size: 256M
Total online memory: 32G
Total offline memory: 2G
In this example, the offline memory blocks are 34-41.
-
Online a specific memory block by writing to its state file:
echo online > /sys/devices/system/memory/memory<_identifier_>/state
Replace memory<_identifier_> with the identifier of the memory block, for example, memory34.
Results
- Verify the memory block is online:
cat /sys/devices/system/memory/memory<_identifier_>/state