
List the available memory to find out how much memory is available and which memory blocks are online.
Procedure
-
Use the lsmem command to list your memory blocks.
For example:
# lsmem -a
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000000000000-0x0000000007ffffff 128M online yes 0
0x0000000008000000-0x000000000fffffff 128M online yes 1
0x0000000010000000-0x0000000017ffffff 128M online yes 2
0x0000000018000000-0x000000001fffffff 128M online yes 3
0x0000000020000000-0x0000000027ffffff 128M online yes 4
0x0000000028000000-0x000000002fffffff 128M online yes 5
0x0000000030000000-0x0000000037ffffff 128M online yes 6
0x0000000038000000-0x000000003fffffff 128M online yes 7
0x0000000040000000-0x0000000047ffffff 128M online yes 8
0x0000000048000000-0x000000004fffffff 128M online yes 9
0x0000000050000000-0x0000000057ffffff 128M offline 10
0x0000000058000000-0x000000005fffffff 128M offline 11
0x0000000060000000-0x0000000067ffffff 128M offline 12
0x0000000068000000-0x000000006fffffff 128M offline 13
0x0000000070000000-0x0000000077ffffff 128M offline 14
0x0000000078000000-0x000000007fffffff 128M offline 15
Memory block size: 128M
Total online memory: 1.3G
Total offline memory: 768M
Memmap on memory parameter: yes
-
Alternatively, you can list the configured memory blocks by listing the contents of /sys/devices/system/memory. Read the state attributes of each memory block to find out whether it is online or offline.
The following command results in an overview for all available memory blocks.
# grep -r --include="state" "line" /sys/devices/system/memory/
/sys/devices/system/memory/memory0/state:online
/sys/devices/system/memory/memory1/state:online
/sys/devices/system/memory/memory2/state:online
/sys/devices/system/memory/memory3/state:online
/sys/devices/system/memory/memory4/state:online
/sys/devices/system/memory/memory5/state:offline
/sys/devices/system/memory/memory6/state:offline
/sys/devices/system/memory/memory7/state:offline
Example
Note: Online blocks are in use by your Linux® instance. An offline block can be free to be added to your Linux instance but it might also be in use by another Linux instance.