1CHMEM(8) System Administration CHMEM(8)
2
3
4
6 chmem - configure memory
7
9 chmem [-h] [-V*] [-v] [-e|-d] [SIZE|RANGE -b BLOCKRANGE] [-z ZONE]
10
12 The chmem command sets a particular size or range of memory online or
13 offline.
14
15 • Specify SIZE as <size>[m|M|g|G]. With m or M, <size> specifies the
16 memory size in MiB (1024 x 1024 bytes). With g or G, <size>
17 specifies the memory size in GiB (1024 x 1024 x 1024 bytes). The
18 default unit is MiB.
19
20 • Specify RANGE in the form 0x<start>-0x<end> as shown in the output
21 of the lsmem(1) command. <start> is the hexadecimal address of the
22 first byte and <end> is the hexadecimal address of the last byte in
23 the memory range.
24
25 • Specify BLOCKRANGE in the form <first>-<last> or <block> as shown
26 in the output of the lsmem(1) command. <first> is the number of the
27 first memory block and <last> is the number of the last memory
28 block in the memory range. Alternatively a single block can be
29 specified. BLOCKRANGE requires the --blocks option.
30
31 • Specify ZONE as the name of a memory zone, as shown in the output
32 of the lsmem -o +ZONES command. The output shows one or more valid
33 memory zones for each memory range. If multiple zones are shown,
34 then the memory range currently belongs to the first zone. By
35 default, chmem will set memory online to the zone Movable, if this
36 is among the valid zones. This default can be changed by specifying
37 the --zone option with another valid zone. For memory ballooning,
38 it is recommended to select the zone Movable for memory online and
39 offline, if possible. Memory in this zone is much more likely to be
40 able to be offlined again, but it cannot be used for arbitrary
41 kernel allocations, only for migratable pages (e.g., anonymous and
42 page cache pages). Use the --help option to see all available
43 zones.
44
45 SIZE and RANGE must be aligned to the Linux memory block size, as shown
46 in the output of the lsmem(1) command.
47
48 Setting memory online can fail for various reasons. On virtualized
49 systems it can fail if the hypervisor does not have enough memory left,
50 for example because memory was overcommitted. Setting memory offline
51 can fail if Linux cannot free the memory. If only part of the requested
52 memory can be set online or offline, a message tells you how much
53 memory was set online or offline instead of the requested amount.
54
55 When setting memory online chmem starts with the lowest memory block
56 numbers. When setting memory offline chmem starts with the highest
57 memory block numbers.
58
60 -b, --blocks
61 Use a BLOCKRANGE parameter instead of RANGE or SIZE for the
62 --enable and --disable options.
63
64 -d, --disable
65 Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline.
66
67 -e, --enable
68 Set the specified RANGE, SIZE, or BLOCKRANGE of memory online.
69
70 -z, --zone
71 Select the memory ZONE where to set the specified RANGE, SIZE, or
72 BLOCKRANGE of memory online or offline. By default, memory will be
73 set online to the zone Movable, if possible.
74
75 -v, --verbose
76 Verbose mode. Causes chmem to print debugging messages about it’s
77 progress.
78
79 -h, --help
80 Display help text and exit.
81
82 -V, --version
83 Print version and exit.
84
86 chmem has the following exit status values:
87
88 0
89 success
90
91 1
92 failure
93
94 64
95 partial success
96
98 chmem --enable 1024
99 This command requests 1024 MiB of memory to be set online.
100
101 chmem -e 2g
102 This command requests 2 GiB of memory to be set online.
103
104 chmem --disable 0x00000000e4000000-0x00000000f3ffffff
105 This command requests the memory range starting with
106 0x00000000e4000000 and ending with 0x00000000f3ffffff to be set
107 offline.
108
109 chmem -b -d 10
110 This command requests the memory block number 10 to be set offline.
111
113 lsmem(1)
114
116 For bug reports, use the issue tracker at
117 https://github.com/util-linux/util-linux/issues.
118
120 The chmem command is part of the util-linux package which can be
121 downloaded from Linux Kernel Archive
122 <https://www.kernel.org/pub/linux/utils/util-linux/>.
123
124
125
126util-linux 2.39.2 2023-06-14 CHMEM(8)