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