]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/chmem.8
Manual pages: Standardize on EXIT STATUS as section title
[thirdparty/util-linux.git] / sys-utils / chmem.8
1 .TH CHMEM 8 "October 2016" "util-linux" "System Administration"
2 .SH NAME
3 chmem \- configure memory
4 .SH SYNOPSIS
5 .B chmem
6 .RB [ \-h "] [" \-V "] [" \-v "] [" \-e | \-d "]"
7 [\fISIZE\fP|\fIRANGE\fP|\fB\-b\fP \fIBLOCKRANGE\fP]
8 [-z ZONE]
9 .SH DESCRIPTION
10 The chmem command sets a particular size or range of memory online or offline.
11 .
12 .IP "\(hy" 2
13 Specify \fISIZE\fP as <size>[m|M|g|G]. With m or M, <size> specifies the memory
14 size in MiB (1024 x 1024 bytes). With g or G, <size> specifies the memory size
15 in GiB (1024 x 1024 x 1024 bytes). The default unit is MiB.
16 .
17 .IP "\(hy" 2
18 Specify \fIRANGE\fP in the form 0x<start>-0x<end> as shown in the output of the
19 \fBlsmem\fP command. <start> is the hexadecimal address of the first byte and <end>
20 is the hexadecimal address of the last byte in the memory range.
21 .
22 .IP "\(hy" 2
23 Specify \fIBLOCKRANGE\fP in the form <first>-<last> or <block> as shown in the
24 output of the \fBlsmem\fP command. <first> is the number of the first memory block
25 and <last> is the number of the last memory block in the memory
26 range. Alternatively a single block can be specified. \fIBLOCKRANGE\fP requires
27 the \fB\-\-blocks\fP option.
28 .
29 .IP "\(hy" 2
30 Specify \fIZONE\fP as the name of a memory zone, as shown in the output of the
31 \fBlsmem \-o +ZONES\fP command. The output shows one or more valid memory zones
32 for each memory range. If multiple zones are shown, then the memory range
33 currently belongs to the first zone. By default, chmem will set memory online
34 to the zone Movable, if this is among the valid zones. This default can be
35 changed by specifying the \fB\-\-zone\fP option with another valid zone.
36 For memory ballooning, it is recommended to select the zone Movable for memory
37 online and offline, if possible. Memory in this zone is much more likely to be
38 able to be offlined again, but it cannot be used for arbitrary kernel
39 allocations, only for migratable pages (e.g., anonymous and page cache pages).
40 Use the \fB\-\-help\fR option to see all available zones.
41 .
42 .PP
43 \fISIZE\fP and \fIRANGE\fP must be aligned to the Linux memory block size, as
44 shown in the output of the \fBlsmem\fP command.
45
46 Setting memory online can fail for various reasons. On virtualized systems it
47 can fail if the hypervisor does not have enough memory left, for example
48 because memory was overcommitted. Setting memory offline can fail if Linux
49 cannot free the memory. If only part of the requested memory can be set online
50 or offline, a message tells you how much memory was set online or offline
51 instead of the requested amount.
52
53 When setting memory online \fBchmem\fP starts with the lowest memory block
54 numbers. When setting memory offline \fBchmem\fP starts with the highest memory
55 block numbers.
56 .SH OPTIONS
57 .TP
58 .BR \-b ", " \-\-blocks
59 Use a \fIBLOCKRANGE\fP parameter instead of \fIRANGE\fP or \fISIZE\fP for the
60 \fB\-\-enable\fP and \fB\-\-disable\fP options.
61 .TP
62 .BR \-d ", " \-\-disable
63 Set the specified \fIRANGE\fP, \fISIZE\fP, or \fIBLOCKRANGE\fP of memory offline.
64 .TP
65 .BR \-e ", " \-\-enable
66 Set the specified \fIRANGE\fP, \fISIZE\fP, or \fIBLOCKRANGE\fP of memory online.
67 .TP
68 .BR \-z ", " \-\-zone
69 Select the memory \fIZONE\fP where to set the specified \fIRANGE\fP, \fISIZE\fP,
70 or \fIBLOCKRANGE\fP of memory online or offline. By default, memory will be set
71 online to the zone Movable, if possible.
72 .TP
73 .BR \-h ", " \-\-help
74 Print a short help text, then exit.
75 .TP
76 .BR \-v ", " \-\-verbose
77 Verbose mode. Causes \fBchmem\fP to print debugging messages about it's
78 progress.
79 .TP
80 .BR \-V ", " \-\-version
81 Print the version number, then exit.
82 .SH EXIT STATUS
83 .B chmem
84 has the following return codes:
85 .TP
86 .B 0
87 success
88 .TP
89 .B 1
90 failure
91 .TP
92 .B 64
93 partial success
94 .SH EXAMPLE
95 .TP
96 .B chmem \-\-enable 1024
97 This command requests 1024 MiB of memory to be set online.
98 .TP
99 .B chmem \-e 2g
100 This command requests 2 GiB of memory to be set online.
101 .TP
102 .B chmem \-\-disable 0x00000000e4000000-0x00000000f3ffffff
103 This command requests the memory range starting with 0x00000000e4000000
104 and ending with 0x00000000f3ffffff to be set offline.
105 .TP
106 .B chmem \-b \-d 10
107 This command requests the memory block number 10 to be set offline.
108 .SH SEE ALSO
109 .BR lsmem (1)
110 .SH AVAILABILITY
111 The \fBchmem\fP command is part of the util-linux package and is available from
112 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
113 Linux Kernel Archive
114 .UE .