Adding memory

SUSE Linux Enterprise Server 15 SP5 LPAR mode z/VM guest

You can add memory to your Linux® instance by setting unused memory blocks online. You can chose a memory zone for certain memory blocks.

About this task

The valid zones for each memory block can be read from the valid_zones sysfs attribute:
# cat /sys/devices/system/memory/memory<n>/valid_zones
Normal Movable

If you intend to take the memory offline again (for example, memory ballooning), preferably add hotplug memory to the Movable zone.

For more information about memory zones, see Memory zones.

Procedure

To add hotplug memory, either:

  • Use the chmem command with the -e parameter to set memory online.
    You can specify the amount of memory you want to add with the command without specifying particular memory blocks. If there are enough eligible memory blocks to satisfy your request, the tool finds them for you and sets the most suitable blocks online.

    The chmem command in SUSE Linux Enterprise Server always tries to set memory online to the zone Movable, if this zone is available as a valid zone.

    For information about the chmem command, see the man page. The chmem command is part of the util-linux package.

  • Use the state sysfs attribute of an unused memory block.
    Issue a command of the form:
    # echo online_value > /sys/devices/system/memory/memory<n>/state
    where online_value is one of:
    online
    sets the memory block online to the default zone. The default zone is the first zone listed in the valid_zones sysfs attribute.
    online_movable
    sets the memory block online to the Movable zone. Setting the block online fails if the Movable zone is not listed in the valid_zones sysfs attribute.
    online_kernel
    sets the memory block online to the first non-Movable zone listed in the valid_zones directory. Setting the block online fails if the Movable zone is the only zone listed in the valid_zones sysfs attribute.
    <n> is an integer that identifies the memory unit.

Results

Adding the memory block fails if the memory block is already in use. The state attribute changes to online when the memory block has been added successfully.