NUMACTL(8) | Linux Administrator's Manual | NUMACTL(8) |
numactl - Control NUMA policy for processes or shared memory
numactl [ --all ] [ --balancing ] [
--interleave nodes ] [ --preferred node ] [
--preferred-many nodes ] [ --membind nodes ] [
--cpunodebind nodes ] [ --physcpubind cpus ] [
--localalloc ] [--] command {arguments ...}
numactl --show
numactl --hardware
numactl [ --huge ] [ --offset offset ] [ --shmmode
shmmode ] [ --length length ] [ --strict ]
[ --shmid id ] --shm shmkeyfile | --file tmpfsfile
[ --touch ] [ --dump ] [ --dump-nodes ] memory policy
numactl runs processes with a specific NUMA scheduling or memory placement policy. The policy is set for command and inherited by all of its children. In addition it can set persistent policy for shared memory segments or files.
Use -- before command if using command options that could be confused with numactl options.
nodes may be specified as N,N,N or N-N or N,N-N or N-N,N-N and so forth. Relative nodes may be specified as +N,N,N or +N-N or +N,N-N and so forth. The + indicates that the node numbers are relative to the process' set of allowed nodes in its current cpuset. A !N-N notation indicates the inverse of N-N, in other words all nodes except N-N. If used with + notation, specify !+N-N. When same is specified the previous nodemask specified on the command line is used. all means all nodes in the current cpuset.
Instead of a number a node can also be:
netdev:DEV | The node connected to network device DEV. |
file:PATH | The node the block device of PATH. |
ip:HOST | The node of the network device of HOST |
block:PATH | The node of block device PATH |
pci:[seg:]bus:dev[:func] | The node of a PCI device. |
Note that block resolves the kernel block device names only for udev names in /dev use file:
This policy is persistent and will be used by all mappings from that shared memory. The order of options matters here. The specification must at least include either of --shm, --shmid, --file to specify the shared memory segment or file and a memory policy like described above ( --interleave, --localalloc, --preferred, --preferred-many, --membind ).
all | All nodes |
number | Node number |
number1{,number2} | Node number1 and Node number2 |
number1-number2 | Nodes from number1 to number2 |
! nodes | Invert selection of the following specification. |
numactl --physcpubind=+0-4,8-12 myapplic arguments Run myapplic on cpus 0-4 and 8-12 of the current cpuset.
numactl --interleave=all bigdatabase arguments Run big database with its memory interleaved on all CPUs.
numactl --cpunodebind=0 --membind=0,1 process Run process on node 0 with memory allocated on node 0 and 1.
numactl --cpunodebind=0 --membind=0,1 -- process -l Run process as above, but with an option (-l) that would be confused with a numactl option.
numactl --cpunodebind=0 --balancing --membind=0,1 process Run process on node 0 with memory allocated on node 0 and 1. Optimize the page placement with Linux kernel NUMA balancing mechanism if possible.
numactl --cpunodebind=netdev:eth0 --membind=netdev:eth0 network-server Run network-server on the node of network device eth0 with its memory also in the same node.
numactl --preferred=1 numactl --show Set preferred node 1 and show the resulting state.
numactl --preferred-many=0x3 numactl --show Set preferred nodes 1 and 2, and show the resulting state.
numactl --interleave=all --shm /tmp/shmkey Interleave all of the sysv shared memory region specified by /tmp/shmkey over all nodes.
Place a tmpfs file on 2 nodes:
numactl --membind=2 dd if=/dev/zero of=/dev/shm/A bs=1M count=1024
numactl --membind=3 dd if=/dev/zero of=/dev/shm/A seek=1024 bs=1M
count=1024
numactl --localalloc /dev/shm/file Reset the policy for the shared memory file file to the default localalloc policy.
Requires a NUMA policy aware kernel.
Command is not executed using a shell. If you want to use shell metacharacters in the child use sh -c as wrapper.
Setting policy for a hugetlbfs file does currently not work because it cannot be extended by truncate.
Shared memory segments larger than numactl's address space cannot be completely policied. This could be a problem on 32bit architectures. Changing it piece by piece may work.
The old --cpubind which accepts node numbers, not cpu numbers, is deprecated and replaced with the new --cpunodebind and --physcpubind options.
/proc/cpuinfo for the listing of active CPUs. See proc(5) for details.
/sys/devices/system/node/node*/numastat for NUMA memory hit statistics.
Copyright 2002,2004 Andi Kleen, SuSE Labs. numactl and the demo programs are under the GNU General Public License, v.2
set_mempolicy(2) , get_mempolicy(2) , mbind(2) , sched_setaffinity(2) , sched_getaffinity(2) , proc(5) , ftok(3) , shmat(2) , migratepages(8)
Mar 2004 | SuSE Labs |