chmem - Man Page

configure memory

Examples (TL;DR)

Synopsis

chmem [-h] [-V] [-v] [-c|-e|-d|-g] [SIZE|RANGE|-b BLOCKRANGE] [-z ZONE] [-m MEMMAP-ON-MEMORY]

Description

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

The --enable option configures the memory, if this is supported by the architecture. If configuring memory is not supported by the architecture, --enable still brings the memory online.

The --disable option brings the memory offline and performs an optional deconfigure step if this is supported by the architecture.

The --configure option requests memory from the hypervisor without bringing it online, when supported by the architecture, allowing explicit control and use of --memmap-on-memory.

The --deconfigure option returns memory resources to the hypervisor if supported by the architecture.

SIZE and RANGE must be aligned to the Linux memory block size, as shown in the output of the lsmem(1) 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 or when configuring memory, chmem starts with the lowest memory block numbers. When setting memory offline or deconfiguring memory, chmem starts with the highest memory block numbers.

Architecture

MEMMAP-ON-MEMORY: For memory blocks configured online at boot, the default value is 0 because they are added without memmap-on-memory support. Memory added dynamically at runtime uses the default value displayed in lsmem output.

Options

-b,  --blocks

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

-c,  --configure

Set the specified RANGE, SIZE, or BLOCKRANGE of memory to be configured.

-d,  --disable

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

-e,  --enable

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

-g,  --deconfigure

Set the specified RANGE, SIZE, or BLOCKRANGE of memory to be deconfigured.

-m,  --memmap-on-memory

Select memmap-on-memory for the specified RANGE, SIZE, or BLOCKRANGE of memory. This option is valid only with --configure.

-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.

-v,  --verbose

Verbose mode. Causes chmem to print debugging messages about its progress.

-h,  --help

Display help text and exit.

-V,  --version

Display version and exit.

Exit Status

chmem has the following exit status values:

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 GB of memory to be brought online and, if supported by the architecture, configures the memory beforehand.

chmem --disable 0x00000000e4000000-0x00000000f3ffffff

This command takes the memory range from 0x00000000e4000000 to 0x00000000f3ffffff offline and deconfigures it if supported by the architecture.

chmem -b -d 10

This command takes memory block number 10 offline.

chmem -b -c 10 -m 1

This command configures memory block 10 with  MEMMAP-ON-MEMORY set. The block must be in a deconfigured state.

chmem -b -c 10

This command configures memory block 10 with the default MEMMAP-ON-MEMORY setting. The default value is displayed in lsmem --output-all. The block must be in a deconfigured state.

chmem -b -g 10

This command deconfigures memory block 10. The block must be offline.

chmem -d 5g

This command takes 5 GB of memory offline and deconfigures it if supported by the architecture. Blocks that are already offline but still configured are skipped and must be explicitly deconfigured with --deconfigure.

See Also

lsmem(1)

Reporting Bugs

For bug reports, use the issue tracker.

Availability

The chmem command is part of the util-linux package which can be downloaded from Linux Kernel Archive.

Referenced By

lsmem(1).

2026-04-01 util-linux 2.42 System Administration