chmem — configure memory

Synopsis

chmem [-h] [-V] [-v] [-e|-d] [SIZE|RANGE|-b BLOCKRANGE] [-z ZONE]

Description

The chmem command sets a particular size or range of memory online or offline.

SIZE and RANGE must be aligned to the Linux memory block size, as shown in the output of the lsmem command.

Setting memory online can fail for various reasons. On virtualized systems it can fail if the hypervisor does not have enough memory left, for example because memory was overcommitted. Setting memory offline can fail if Linux cannot free the memory. If only part of the requested memory can be set online or offline, a message tells you how much memory was set online or offline instead of the requested amount.

When setting memory online chmem starts with the lowest memory block numbers. When setting memory offline chmem starts with the highest memory block numbers.

Options

-b, --blocks

Use a BLOCKRANGE parameter instead of RANGE or SIZE for the --enable and --disable options.

-d, --disable

Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline.

-e, --enable

Set the specified RANGE, SIZE, or BLOCKRANGE of memory online.

-z, --zone

Select the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory online or offline. By default, memory will be set online to the zone Movable, if possible.

-h, --help

Print a short help text, then exit.

-v, --verbose

Verbose mode. Causes chmem to print debugging messages about it's progress.

-V, --version

Print the version number, then exit.

Return Codes

chmem has the following return codes:

0

success

1

failure

64

partial success

Examples

chmem --enable 1024

This command requests 1024 MiB of memory to be set online.

chmem -e 2g

This command requests 2 GiB of memory to be set online.

chmem --disable 0x00000000e4000000-0x00000000f3ffffff

This command requests the memory range starting with 0x00000000e4000000 and ending with 0x00000000f3ffffff to be set offline.

chmem -b -d 10

This command requests the memory block number 10 to be set offline.

See Also

lsmem(1)

Availability

The chmem command is part of the util-linux package and is available from Linux Kernel Archive.

Referenced By

lsmem(1).

October 2016 util-linux System Administration