1CHMEM(8)                     System Administration                    CHMEM(8)
2
3
4

NAME

6       chmem - configure memory
7

SYNOPSIS

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

DESCRIPTION

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> specifies
17         the memory size in GiB (1024 x 1024 x 1024 bytes). The  default  unit
18         is MiB.
19
20       ‐ Specify RANGE in the form 0x<start>-0x<end> as shown in the output of
21         the lsmem command. <start> is the hexadecimal address  of  the  first
22         byte  and  <end>  is  the hexadecimal address of the last byte in the
23         memory range.
24
25       ‐ Specify BLOCKRANGE in the form <first>-<last> or <block> as shown  in
26         the  output  of the lsmem command. <first> is the number of the first
27         memory block and <last> is the number of the last memory block in the
28         memory  range.  Alternatively a single block can be specified. BLOCK‐
29         RANGE requires the --blocks option.
30
31       ‐ Specify ZONE as the name of a memory zone, as shown in the output  of
32         the  lsmem -o +ZONES command. The output shows one or more valid mem‐
33         ory zones for each memory range. If multiple zones  are  shown,  then
34         the  memory  range  currently  belongs to the first zone. By default,
35         chmem will set memory online to the zone Movable, if  this  is  among
36         the valid zones. This default can be changed by specifying the --zone
37         option with another valid zone.  For memory ballooning, it is  recom‐
38         mended  to  select the zone Movable for memory online and offline, if
39         possible. Memory in this zone is much more likely to be  able  to  be
40         offlined  again,  but  it cannot be used for arbitrary kernel alloca‐
41         tions, only for migratable  pages  (e.g.  anonymous  and  page  cache
42         pages).  Use the --help option to see all available zones.
43
44       SIZE and RANGE must be aligned to the Linux memory block size, as shown
45       in the output of the lsmem command.
46
47       Setting memory online can fail for various reasons. On virtualized sys‐
48       tems  it  can  fail if the hypervisor does not have enough memory left,
49       for example because memory was overcommitted.  Setting  memory  offline
50       can fail if Linux cannot free the memory. If only part of the requested
51       memory can be set online or offline, a message tells you how much  mem‐
52       ory was set online or offline instead of the requested amount.
53
54       When  setting  memory  online chmem starts with the lowest memory block
55       numbers. When setting memory offline chmem starts with the highest mem‐
56       ory block numbers.
57

OPTIONS

59       -b, --blocks
60              Use  a  BLOCKRANGE  parameter  instead  of RANGE or SIZE for the
61              --enable and --disable options.
62
63       -d, --disable
64              Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline.
65
66       -e, --enable
67              Set the specified RANGE, SIZE, or BLOCKRANGE of memory online.
68
69       -z, --zone
70              Select the memory ZONE where to set the specified  RANGE,  SIZE,
71              or  BLOCKRANGE  of  memory online or offline. By default, memory
72              will be set online to the zone Movable, if possible.
73
74       -h, --help
75              Print a short help text, then exit.
76
77       -v, --verbose
78              Verbose mode. Causes chmem to  print  debugging  messages  about
79              it's progress.
80
81       -V, --version
82              Print the version number, then exit.
83

RETURN CODES

85       chmem has the following return codes:
86
87       0      success
88
89       1      failure
90
91       64     partial success
92

EXAMPLES

94       chmem --enable 1024
95              This command requests 1024 MiB of memory to be set online.
96
97       chmem -e 2g
98              This command requests 2 GiB of memory to be set online.
99
100       chmem --disable 0x00000000e4000000-0x00000000f3ffffff
101              This   command   requests   the   memory   range  starting  with
102              0x00000000e4000000 and ending with 0x00000000f3ffffff to be  set
103              offline.
104
105       chmem -b -d 10
106              This  command requests the memory block number 10 to be set off‐
107              line.
108

SEE ALSO

110       lsmem(1)
111

AVAILABILITY

113       The chmem command is part of the util-linux package  and  is  available
114       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
115       linux/⟩.
116
117
118
119util-linux                       October 2016                         CHMEM(8)
Impressum