Adding memory

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

Suspend and resume:

Do not add hotplug memory if you intend to suspend the Linux instance before the next IPL. Any changes to the original memory configuration prevent suspension, even if you restore the original memory configuration by removing memory blocks that were added.

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:

  • 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.
  • 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 SLES 12 SP3 always tries to set memory online to the zone Movable, if this zone is available as a valid zone.

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.