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 ] [ --interleave nodes ] [ --preferred node ] [ --mem‐
10       bind nodes  ]  [  --cpunodebind  nodes  ]  [  --physcpubind  cpus  ]  [
11       --localalloc ] [--] 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

DESCRIPTION

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

EXAMPLES

160       numactl --physcpubind=+0-4,8-12 myapplic arguments Run myapplic on cpus
161       0-4 and 8-12 of the current cpuset.
162
163       numactl --interleave=all bigdatabase arguments Run  big  database  with
164       its memory interleaved on all CPUs.
165
166       numactl  --cpunodebind=0  --membind=0,1  process  Run process on node 0
167       with memory allocated on node 0 and 1.
168
169       numactl --cpunodebind=0 --membind=0,1 --  process  -l  Run  process  as
170       above,  but  with  an option (-l) that would be confused with a numactl
171       option.
172
173       numactl --cpunodebind=netdev:eth0 --membind=netdev:eth0  network-server
174       Run  network-server  on the node of network device eth0 with its memory
175       also in the same node.
176
177       numactl --preferred=1 numactl --show Set preferred node 1 and show  the
178       resulting state.
179
180       numactl  --interleave=all  --shm /tmp/shmkey Interleave all of the sysv
181       shared memory region specified by /tmp/shmkey over all nodes.
182
183       Place a tmpfs file on 2 nodes:
184         numactl --membind=2 dd if=/dev/zero of=/dev/shm/A bs=1M count=1024
185         numactl --membind=3 dd  if=/dev/zero  of=/dev/shm/A  seek=1024  bs=1M
186       count=1024
187
188
189       numactl --localalloc /dev/shm/file Reset the policy for the shared mem‐
190       ory file file to the default localalloc policy.
191

NOTES

193       Requires an NUMA policy aware kernel.
194
195       Command is not executed using  a  shell.  If  you  want  to  use  shell
196       metacharacters in the child use sh -c as wrapper.
197
198       Setting  policy for a hugetlbfs file does currently not work because it
199       cannot be extended by truncate.
200
201       Shared memory segments larger than numactl's address  space  cannot  be
202       completely  policied.  This  could be a problem on 32bit architectures.
203       Changing it piece by piece may work.
204
205       The old --cpubind which accepts node numbers, not cpu numbers, is  dep‐
206       recated  and  replaced  with  the  new  --cpunodebind and --physcpubind
207       options.
208
209

FILES

211       /proc/cpuinfo for the listing of active CPUs. See proc(5) for details.
212
213       /sys/devices/system/node/node*/numastat for NUMA memory hit statistics.
214
215
217       Copyright 2002,2004 Andi Kleen, SuSE Labs.  numactl and the  demo  pro‐
218       grams are under the GNU General Public License, v.2
219
220

SEE ALSO

222       set_mempolicy(2) , get_mempolicy(2) , mbind(2) , sched_setaffinity(2) ,
223       sched_getaffinity(2) , proc(5) , ftok(3) , shmat(2) , migratepages(8)
224
225
226
227
228SuSE Labs                          Mar 2004                         NUMACTL(8)
Impressum