1NUMACTL(8)               Linux Administrator's Manual               NUMACTL(8)
2
3
4

NAME

6       numactl - Control NUMA policy for processes or shared memory
7

SYNOPSIS

9       numactl  [ --all ] [ --balancing ] [ --interleave nodes ] [ --preferred
10       node ] [ --preferred-many nodes ] [ --membind nodes ]  [  --cpunodebind
11       nodes ] [ --physcpubind cpus ] [ --localalloc ] [--] command {arguments
12       ...}
13       numactl --show
14       numactl --hardware
15       numactl [ --huge ] [ --offset offset ] [ --shmmode shmmode ] [ --length
16       length ] [ --strict ]
17       [ --shmid id ] --shm shmkeyfile | --file tmpfsfile
18       [ --touch ] [ --dump ] [ --dump-nodes ] memory policy
19

DESCRIPTION

21       numactl runs processes with a specific NUMA scheduling or memory place‐
22       ment policy.  The policy is set for command and inherited by all of its
23       children.   In  addition it can set persistent policy for shared memory
24       segments or files.
25
26       Use -- before command if using command options that could  be  confused
27       with numactl options.
28
29       nodes  may  be  specified  as N,N,N or  N-N or N,N-N or  N-N,N-N and so
30       forth.  Relative nodes may be specified as +N,N,N or   +N-N  or  +N,N-N
31       and so forth. The + indicates that the node numbers are relative to the
32       process' set of allowed nodes in its current cpuset.  A  !N-N  notation
33       indicates  the inverse of N-N, in other words all nodes except N-N.  If
34       used with + notation, specify !+N-N. When same is specified the  previ‐
35       ous  nodemask  specified  on  the  command line is used.  all means all
36       nodes in the current cpuset.
37
38       Instead of a number a node can also be:
39
40       netdev:DEV                 The node connected to network device DEV.
41       file:PATH                  The node the block device of PATH.
42       ip:HOST                    The node of the network device of HOST
43       block:PATH                 The node of block device PATH
44       pci:[seg:]bus:dev[:func]   The node of a PCI device.
45
46       Note that block resolves the kernel block device names  only  for  udev
47       names in /dev use file:
48
49       Policy settings are:
50
51       --all, -a
52              Unset  default  cpuset  awareness,  so user can use all possible
53              CPUs/nodes for following policy settings.
54
55       --interleave=nodes, -i nodes
56              Set a memory interleave policy. Memory will be  allocated  using
57              round  robin  on  nodes.  When memory cannot be allocated on the
58              current interleave target fall back to  other  nodes.   Multiple
59              nodes may be specified on --interleave, --membind and --cpunode‐
60              bind.
61
62       --membind=nodes, -m nodes
63              Only allocate memory from  nodes.   Allocation  will  fail  when
64              there  is not enough memory available on these nodes.  nodes may
65              be specified as noted above.
66
67       --cpunodebind=nodes, -N nodes
68              Only execute command on the CPUs of nodes.  Note that nodes  may
69              consist  of  multiple  CPUs.   nodes  may  be specified as noted
70              above.
71
72       --physcpubind=cpus, -C cpus
73              Only execute process on cpus.  This accepts cpu numbers as shown
74              in the processor fields of /proc/cpuinfo, or relative cpus as in
75              relative to the current cpuset.  You may  specify  "all",  which
76              means  all  cpus  in  the  current cpuset.  Physical cpus may be
77              specified as N,N,N or  N-N or N,N-N or  N-N,N-N  and  so  forth.
78              Relative  cpus may be specified as +N,N,N or  +N-N or +N,N-N and
79              so forth. The + indicates that the cpu numbers are  relative  to
80              the  process' set of allowed cpus in its current cpuset.  A !N-N
81              notation indicates the inverse of N-N, in other words  all  cpus
82              except N-N.  If used with + notation, specify !+N-N.
83
84       --localalloc, -l
85              Try  to allocate on the current node of the process, but if mem‐
86              ory cannot be allocated there fall back to other nodes.
87
88       --preferred=node
89              Preferably allocate memory on node, but if memory cannot be  al‐
90              located  there fall back to other nodes.  This option takes only
91              a single node number.  Relative notation may be used.
92
93       --balancing, -b
94              Enable Linux kernel NUMA balancing for the process if it is sup‐
95              ported  by  kernel.  This should only be used with --membind, -m
96              only, otherwise ignored.
97
98       --preferred-many=node
99              Preferably allocate memory on nodes, but if memory cannot be al‐
100              located  there  fall  back  to other nodes.  This option takes a
101              mask of preferred nodes where the closest node to local is  con‐
102              sidered most preferred.  Relative notation may be used.
103
104       --show, -s
105              Show NUMA policy settings of the current process.
106
107       --hardware, -H
108              Show inventory of available nodes on the system.
109
110       Numactl can set up policy for a SYSV shared memory segment or a file in
111       shmfs/hugetlbfs.
112
113       This policy is persistent and will be used by all  mappings  from  that
114       shared  memory.  The  order of options matters here.  The specification
115       must at least include either of --shm, --shmid, --file to  specify  the
116       shared  memory segment or file and a memory policy like described above
117       ( --interleave, --localalloc, --preferred, --preferred-many,  --membind
118       ).
119
120       --huge
121       When  creating a SYSV shared memory segment use huge pages.  Only valid
122       before --shmid or --shm
123
124       --offset
125       Specify offset into the shared memory segment. Default 0.  Valid  units
126       are m (for MB), g (for GB), k (for KB), otherwise it specifies bytes.
127
128       --strict
129       Give  an  error  when  a page in the policied area in the shared memory
130       segment already was faulted in with a conflicting policy. Default is to
131       silently ignore this.
132
133       --shmmode shmmode
134       Only  valid  before --shmid or --shm When creating a shared memory seg‐
135       ment set it to numeric mode shmmode.
136
137       --length length
138       Apply policy to length range in the shared memory segment or  make  the
139       segment  length  long  Default  is to use the remaining length Required
140       when a shared memory segment is created and specifies the length of the
141       new  segment  then. Valid units are m (for MB), g (for GB), k (for KB),
142       otherwise it specifies bytes.
143
144       --shmid id
145       Create or use a shared memory segment with numeric ID id
146
147       --shm shmkeyfile
148       Create or use a shared memory segment,  with  the  ID  generated  using
149       ftok(3) from shmkeyfile
150
151       --file tmpfsfile
152       Set policy for a file in tmpfs or hugetlbfs
153
154       --touch
155       Touch  pages to enforce policy early. Default is to not touch them, the
156       policy is applied when an applications maps and accesses a page.
157
158       --dump
159       Dump policy in the specified range.
160
161       --dump-nodes
162       Dump all nodes of the specific range (very verbose!)
163
164       Valid node specifiers
165
166       all                 All nodes
167       number              Node number
168       number1{,number2}   Node number1 and Node number2
169       number1-number2     Nodes from number1 to number2
170       ! nodes             Invert selection of the following specification.
171

EXAMPLES

173       numactl --physcpubind=+0-4,8-12 myapplic arguments Run myapplic on cpus
174       0-4 and 8-12 of the current cpuset.
175
176       numactl  --interleave=all  bigdatabase  arguments Run big database with
177       its memory interleaved on all CPUs.
178
179       numactl --cpunodebind=0 --membind=0,1 process Run  process  on  node  0
180       with memory allocated on node 0 and 1.
181
182       numactl  --cpunodebind=0  --membind=0,1  --  process  -l Run process as
183       above, but with an option (-l) that would be confused  with  a  numactl
184       option.
185
186       numactl  --cpunodebind=0  --balancing --membind=0,1 process Run process
187       on node 0 with memory allocated on node 0 and  1.   Optimize  the  page
188       placement with Linux kernel NUMA balancing mechanism if possible.
189
190       numactl  --cpunodebind=netdev:eth0 --membind=netdev:eth0 network-server
191       Run network-server on the node of network device eth0 with  its  memory
192       also in the same node.
193
194       numactl  --preferred=1 numactl --show Set preferred node 1 and show the
195       resulting state.
196
197       numactl --preferred-many=0x3 numactl --show Set preferred nodes  1  and
198       2, and show the resulting state.
199
200       numactl  --interleave=all  --shm /tmp/shmkey Interleave all of the sysv
201       shared memory region specified by /tmp/shmkey over all nodes.
202
203       Place a tmpfs file on 2 nodes:
204         numactl --membind=2 dd if=/dev/zero of=/dev/shm/A bs=1M count=1024
205         numactl --membind=3 dd  if=/dev/zero  of=/dev/shm/A  seek=1024  bs=1M
206       count=1024
207
208
209       numactl --localalloc /dev/shm/file Reset the policy for the shared mem‐
210       ory file file to the default localalloc policy.
211

NOTES

213       Requires a NUMA policy aware kernel.
214
215       Command is not executed using  a  shell.  If  you  want  to  use  shell
216       metacharacters in the child use sh -c as wrapper.
217
218       Setting  policy for a hugetlbfs file does currently not work because it
219       cannot be extended by truncate.
220
221       Shared memory segments larger than numactl's address  space  cannot  be
222       completely  policied.  This  could be a problem on 32bit architectures.
223       Changing it piece by piece may work.
224
225       The old --cpubind which accepts node numbers, not cpu numbers, is  dep‐
226       recated  and  replaced with the new --cpunodebind and --physcpubind op‐
227       tions.
228
229

FILES

231       /proc/cpuinfo for the listing of active CPUs. See proc(5) for details.
232
233       /sys/devices/system/node/node*/numastat for NUMA memory hit statistics.
234
235
237       Copyright 2002,2004 Andi Kleen, SuSE Labs.  numactl and the  demo  pro‐
238       grams are under the GNU General Public License, v.2
239
240

SEE ALSO

242       set_mempolicy(2) , get_mempolicy(2) , mbind(2) , sched_setaffinity(2) ,
243       sched_getaffinity(2) , proc(5) , ftok(3) , shmat(2) , migratepages(8)
244
245
246
247
248SuSE Labs                          Mar 2004                         NUMACTL(8)
Impressum