lsmem - Show online status information about memory blocks

Use the lsmem command to list the ranges of available memory with their online status.

The listed memory blocks correspond to the memory block representation in sysfs. The command also shows the memory block size, the device size, and the amount of memory in online and offline state.

lsmem syntax


1  lsmem
2.1 -a
Where:
-a or --all
lists each individual memory block, instead of combining memory blocks with similar attributes.
-v or --version
displays the version number of lsmem, then exits.
-h or --help
displays a short help text, then exits. To view the man page, enter man lsmem.
The columns in the command output have this meaning:
Address range
Start and end address of the memory range.
Size
Size of the memory range in MB (1024 x 1024 bytes).
State
Indication of the online status of the memory range. State on->off means that the address range is in transition from online to offline.
Removable
yes if the memory range can be set offline, no if it cannot be set offline. A dash (-) means that the range is already offline. The kernel method that identifies removable memory ranges is heuristic and not exact. Occasionally, memory ranges are falsely reported as removable or falsely reported as not removable.
Device
Device number or numbers that correspond to the memory range.

A device represents a unit of memory for the hypervisor in control of the memory. The hypervisor cannot reuse a device unless the entire corresponding memory range is offline.

The memory units that you can set online or offline from Linux are memory blocks. In most memory configurations, there is a one-to-one mapping of devices and memory blocks or a mapping of multiple devices to a single memory block. In other configurations, multiple memory blocks might map to a single device. Memory might be used inefficiently if a device includes both online and offline memory blocks.

The chmem command with the size parameter automatically chooses the best suited device or devices for setting memory online or offline. The device size depends on the hypervisor and on the amount of total online and offline memory.

Examples

  • The output of this command, shows ranges of adjacent memory blocks with similar attributes.
    # lsmem
    Address range                          Size (MB)  State    Removable  Device
    ===============================================================================
    0x0000000000000000-0x000000000fffffff        256  online   no         0
    0x0000000010000000-0x000000002fffffff        512  online   yes        1-2
    0x0000000030000000-0x000000003fffffff        256  online   no         3
    0x0000000040000000-0x000000006fffffff        768  online   yes        4-6
    0x0000000070000000-0x00000000ffffffff       2304  offline  -          7-15
    
    Memory device size  : 256 MB
    Memory block size   : 256 MB
    Total online memory : 1792 MB
    Total offline memory: 2304 MB
  • The output of this command, shows each memory block as a separate range.
    # lsmem -a
    Address range                          Size (MB)  State    Removable  Device
    ===============================================================================
    0x0000000000000000-0x000000000fffffff        256  online   no         0
    0x0000000010000000-0x000000001fffffff        256  online   yes        1
    0x0000000020000000-0x000000002fffffff        256  online   yes        2
    0x0000000030000000-0x000000003fffffff        256  online   no         3
    0x0000000040000000-0x000000004fffffff        256  online   yes        4
    0x0000000050000000-0x000000005fffffff        256  online   yes        5
    0x0000000060000000-0x000000006fffffff        256  online   yes        6
    0x0000000070000000-0x000000007fffffff        256  offline  -          7
    0x0000000080000000-0x000000008fffffff        256  offline  -          8
    0x0000000090000000-0x000000009fffffff        256  offline  -          9
    0x00000000a0000000-0x00000000afffffff        256  offline  -          10
    0x00000000b0000000-0x00000000bfffffff        256  offline  -          11
    0x00000000c0000000-0x00000000cfffffff        256  offline  -          12
    0x00000000d0000000-0x00000000dfffffff        256  offline  -          13
    0x00000000e0000000-0x00000000efffffff        256  offline  -          14
    0x00000000f0000000-0x00000000ffffffff        256  offline  -          15
    
    Memory device size  : 256 MB
    Memory block size   : 256 MB
    Total online memory : 1792 MB
    Total offline memory: 2304 MB