1NUMACTL(8) Linux Administrator's Manual NUMACTL(8)
2
3
4
6 numactl - Control NUMA policy for processes or shared memory
7
9 numactl [ --interleave nodes ] [ --preferred node ] [ --membind nodes ]
10 [ --cpunodebind nodes ] [ --physcpubind cpus ] [ --localalloc ] [--]
11 command {arguments ...}
12 numactl --show
13 numactl --hardware
14 numactl [ --huge ] [ --offset offset ] [ --shmmode shmmode ] [ --length
15 length ] [ --strict ]
16 [ --shmid id ] --shm shmkeyfile | --file tmpfsfile
17 [ --touch ] [ --dump ] [ --dump-nodes ] memory policy
18
20 numactl runs processes with a specific NUMA scheduling or memory place‐
21 ment policy. The policy is set for command and inherited by all of its
22 children. In addition it can set persistent policy for shared memory
23 segments or files.
24
25 Use -- before command if using command options that could be confused
26 with numactl options.
27
28 Policy settings are:
29
30 --interleave=nodes, -i nodes
31 Set a memory interleave policy. Memory will be allocated using
32 round robin on nodes. When memory cannot be allocated on the
33 current interleave target fall back to other nodes. Multiple
34 nodes may be specified on --interleave, --membind and --cpunode‐
35 bind. You may specify "all", which means all nodes in the cur‐
36 rent cpuset. nodes may be specified as N,N,N or N-N or N,N-N
37 or N-N,N-N and so forth. Relative nodes may be specifed as
38 +N,N,N or +N-N or +N,N-N and so forth. The + indicates that the
39 node numbers are relative to the process' set of allowed nodes
40 in its current cpuset. A !N-N notation indicates the inverse of
41 N-N, in other words all nodes except N-N. If used with + nota‐
42 tion, specify !+N-N.
43
44 --membind=nodes, -m nodes
45 Only allocate memory from nodes. Allocation will fail when
46 there is not enough memory available on these nodes. nodes may
47 be specified as noted above.
48
49 --cpunodebind=nodes, -N nodes
50 Only execute command on the CPUs of nodes. Note that nodes may
51 consist of multiple CPUs. nodes may be specified as noted
52 above.
53
54 --physcpubind=cpus, -C cpus
55 Only execute process on cpus. This accepts physical cpu numbers
56 as shown in the processor fields of /proc/cpuinfo, or relative
57 cpus as in relative to the current cpuset. You may specify
58 "all", which means all cpus in the current cpuset. Physical
59 cpus may be specified as N,N,N or N-N or N,N-N or N-N,N-N and
60 so forth. Relative cpus may be specifed as +N,N,N or +N-N or
61 +N,N-N and so forth. The + indicates that the cpu numbers are
62 relative to the process' set of allowed cpus in its current
63 cpuset. A !N-N notation indicates the inverse of N-N, in other
64 words all cpus except N-N. If used with + notation, specify
65 !+N-N.
66
67 --localalloc, -l
68 Always allocate on the current node.
69
70 --preferred=node
71 Preferably allocate memory on node, but if memory cannot be
72 allocated there fall back to other nodes. This option takes
73 only a single node number. Relative notation may be used.
74
75 --show, -s
76 Show NUMA policy settings of the current process.
77
78 --hardware, -H
79 Show inventory of available nodes on the system.
80
81 Numactl can set up policy for a SYSV shared memory segment or a file in
82 shmfs/hugetlbfs.
83
84 This policy is persistent and will be used by all mappings from that
85 shared memory. The order of options matters here. The specification
86 must at least include either of --shm, --shmid, --file to specify the
87 shared memory segment or file and a memory policy like described above
88 ( --interleave, --localalloc, --prefered, --membind ).
89
90 --huge
91 When creating a SYSV shared memory segment use huge pages. Only valid
92 before --shmid or --shm
93
94 --offset
95 Specify offset into the shared memory segment. Default 0. Valid units
96 are m (for MB), g (for GB), k (for KB), otherwise it specifies bytes.
97
98 --strict
99 Give an error when a page in the policied area in the shared memory
100 segment already was faulted in with a conflicting policy. Default is to
101 silently ignore this.
102
103 --shmmode shmmode
104 Only valid before --shmid or --shm When creating a shared memory seg‐
105 ment set it to numeric mode shmmode.
106
107 --length length
108 Apply policy to length range in the shared memory segment or make the
109 segment length long Default is to use the remaining length Required
110 when a shared memory segment is created and specifies the length of the
111 new segment then. Valid units are m (for MB), g (for GB), k (for KB),
112 otherwise it specifies bytes.
113
114 --shmid id
115 Create or use an shared memory segment with numeric ID id
116
117 --shm shmkeyfile
118 Create or use an shared memory segment, with the ID generated using
119 ftok(3) from shmkeyfile
120
121 --file tmpfsfile
122 Set policy for a file in tmpfs or hugetlbfs
123
124 --touch
125 Touch pages to enforce policy early. Default is to not touch them, the
126 policy is applied when an applications maps and accesses a page.
127
128 --dump
129 Dump policy in the specified range.
130
131 --dump-nodes
132 Dump all nodes of the specific range (very verbose!)
133
134 Valid node specifiers
135
136 all All nodes
137 number Node number
138 number1{,number2} Node number1 and Node number2
139 number1-number2 Nodes from number1 to number2
140 ! nodes Invert selection of the following specification.
141
143 numactl --physcpubind=+0-4,8-12 myapplic arguments Run myapplic on cpus
144 0-4 and 8-12 of the current cpuset.
145
146 numactl --interleave=all bigdatabase arguments Run big database with
147 its memory interleaved on all CPUs.
148
149 numactl --cpubind=0 --membind=0,1 process Run process on node 0 with
150 memory allocated on node 0 and 1.
151
152 numactl --cpubind=0 --membind=0,1 -- process -l Run process as above,
153 but with an option (-l) that would be confused with a numactl option.
154
155 numactl --preferred=1 numactl --show Set preferred node 1 and show the
156 resulting state.
157
158 numactl --interleave=all --shmkeyfile /tmp/shmkey Interleave all of the
159 sysv shared memory regiion specified by /tmp/shmkey over all nodes.
160
161 numactl --offset=1G --length=1G --membind=1 --file /dev/shm/A --touch
162 Bind the second gigabyte in the tmpfs file /dev/shm/A to node 1.
163
164 numactl --localalloc /dev/shm/file Reset the policy for the shared mem‐
165 ory file file to the default localalloc policy.
166
168 Requires an NUMA policy aware kernel.
169
170 Command is not executed using a shell. If you want to use shell
171 metacharacters in the child use sh -c as wrapper.
172
173 Setting policy for a hugetlbfs file does currently not work because it
174 cannot be extended by truncate.
175
176 Shared memory segments larger than numactl's address space cannot be
177 completely policied. This could be a problem on 32bit architectures.
178 Changing it piece by piece may work.
179
180 The old --cpubind which accepts node numbers, not cpu numbers, is dep‐
181 recated and replaced with the new --cpunodebind and --physcpubind
182 options.
183
184
186 /proc/cpuinfo for the listing of active CPUs. See proc(5) for details.
187
188 /sys/devices/system/node/node*/numastat for NUMA memory hit statistics.
189
190
192 Copyright 2002,2004 Andi Kleen, SuSE Labs. numactl and the demo pro‐
193 grams are under the GNU General Public License, v.2
194
195
197 set_mempolicy(2) , get_mempolicy(2) , mbind(2) , sched_setaffinity(2) ,
198 sched_getaffinity(2) , proc(5) , ftok(3) , shmat(2) , migratepages(8)
199
200
201
202
203SuSE Labs Mar 2004 NUMACTL(8)