1CPUSET(7) Linux Programmer's Manual CPUSET(7)
2
3
4
6 cpuset - confine processes to processor and memory node subsets
7
9 The cpuset filesystem is a pseudo-filesystem interface to the kernel
10 cpuset mechanism, which is used to control the processor placement and
11 memory placement of processes. It is commonly mounted at /dev/cpuset.
12
13 On systems with kernels compiled with built in support for cpusets, all
14 processes are attached to a cpuset, and cpusets are always present. If
15 a system supports cpusets, then it will have the entry nodev cpuset in
16 the file /proc/filesystems. By mounting the cpuset filesystem (see the
17 EXAMPLES section below), the administrator can configure the cpusets on
18 a system to control the processor and memory placement of processes on
19 that system. By default, if the cpuset configuration on a system is
20 not modified or if the cpuset filesystem is not even mounted, then the
21 cpuset mechanism, though present, has no effect on the system's behav‐
22 ior.
23
24 A cpuset defines a list of CPUs and memory nodes.
25
26 The CPUs of a system include all the logical processing units on which
27 a process can execute, including, if present, multiple processor cores
28 within a package and Hyper-Threads within a processor core. Memory
29 nodes include all distinct banks of main memory; small and SMP systems
30 typically have just one memory node that contains all the system's main
31 memory, while NUMA (non-uniform memory access) systems have multiple
32 memory nodes.
33
34 Cpusets are represented as directories in a hierarchical pseudo-
35 filesystem, where the top directory in the hierarchy (/dev/cpuset) rep‐
36 resents the entire system (all online CPUs and memory nodes) and any
37 cpuset that is the child (descendant) of another parent cpuset contains
38 a subset of that parent's CPUs and memory nodes. The directories and
39 files representing cpusets have normal filesystem permissions.
40
41 Every process in the system belongs to exactly one cpuset. A process
42 is confined to run only on the CPUs in the cpuset it belongs to, and to
43 allocate memory only on the memory nodes in that cpuset. When a
44 process fork(2)s, the child process is placed in the same cpuset as its
45 parent. With sufficient privilege, a process may be moved from one
46 cpuset to another and the allowed CPUs and memory nodes of an existing
47 cpuset may be changed.
48
49 When the system begins booting, a single cpuset is defined that in‐
50 cludes all CPUs and memory nodes on the system, and all processes are
51 in that cpuset. During the boot process, or later during normal system
52 operation, other cpusets may be created, as subdirectories of this top
53 cpuset, under the control of the system administrator, and processes
54 may be placed in these other cpusets.
55
56 Cpusets are integrated with the sched_setaffinity(2) scheduling affin‐
57 ity mechanism and the mbind(2) and set_mempolicy(2) memory-placement
58 mechanisms in the kernel. Neither of these mechanisms let a process
59 make use of a CPU or memory node that is not allowed by that process's