CPUSET(1)
π cpuset(1) β configure processor sets π
okay so this is cpuset(1) from the General Commands Manual, and we're about to make processor sets make sense. no cap, bestie. π¦
π NAME π
cpuset β configure processor sets. literally the whole vibe. π
β¨ SYNOPSIS β¨
cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] cmd ...
cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] -p pid
cpuset [-c] [-l cpu-list] [-n policy:domain-list] -C -p pid
cpuset [-c] [-l cpu-list] [-n policy:domain-list]
[-j jail | -p pid | -t tid | -s setid | -x irq]
cpuset -g [-cir]
[-d domain | -j jail | -p pid | -t tid | -s setid | -x irq]
πΈ DESCRIPTION πΈ
The cpuset command is your little main-character tool for assigning processor sets to processes, running commands constrained to a given set or list of processors and memory domains, and querying info about processor binding, memory binding and policy, sets, and the available processors and memory domains in the system. iconic. β¨
cpuset requires a target to modify or query. The target may be specified as a command, process id, thread id, a cpuset id, an irq, a jail, or a NUMA domain. Using -g, the target's set id or mask may be queried. Using -l or -s, the target's CPU mask or set id may be set. If no target is specified, cpuset operates on itself β self-care, but for processes π
. Not all combinations of operations and targets are supported. For example, you may not set the id of an existing set or query and launch a command at the same time. vibe check: failed, bestie π.
There are two sets applicable to each process and one private mask per thread. Every process in the system belongs to a cpuset. By default processes are started in set 1. The mask or id may be queried using -c. Each thread also has a private mask of CPUs it is allowed to run on that must be a subset of the assigned set. And finally, there is a root set, numbered 0, that is immutable. This last set is the list of all possible CPUs in the system and is queried using -r. periodt. π§
Most sets include NUMA memory domain and policy information. This can be inspected with -g and set with -n. This will specify which NUMA domains are visible to the process and affect where anonymous memory and file pages will be stored on first access. Files accessed first by other processes may specify conflicting policy. conflict alert, but make it memory. π
When running a command it may join a set specified with -s; otherwise a new set is created. In addition, a mask for the command may be specified using -l. When used in conjunction with -c, the mask modifies the supplied or created set rather than the private mask for the thread. the way that detail matters π«Ά.
The options are as follows:
π OPTIONS π
-Cβ Create a new cpuset and assign the target process to that set. new set, who dis π-cβ The requested operation should reference the cpuset available via the target specifier.-d domainβ Specifies a NUMA domain id as the target of the operation. This can only be used to query the CPUs visible in each numberd domain. (yes,numberdis what the page says π)-gβ Causescpusetto print either a list of valid CPUs or, using-i, the id of the target.-iβ When used with the-goption, print the id rather than the valid mask of the target.-j jailβ Specifies a jail id or name as the target of the operation.-l cpu-listβ Specifies a list of CPUs to apply to a target. Specification may include numbers separated by-for ranges and commas separating individual numbers. A special list of βallβ may be specified, in which case the list includes all CPUs from the root set. range core, honestly π-n policy:domain-listβ Specifies a list of domains and allocation policy to apply to a target. Ranges may be specified as in-l. Valid policies include first-touch (ft), round-robin (rr), prefer and interleave (il). First-touch allocates on the local domain when memory is available. Round-robin alternates between every possible domain page at a time. The prefer policy accepts only a single domain in the set. The parent of the set is consulted if the preferred domain is unavailable. Interleave operates like round-robin with an implementation defined stripe width. Seedomainset(9)for more details on policies. policy girlie has entered the chat π-p pidβ Specifies a pid as the target of the operation.-s setidβ Specifies a set id as the target of the operation.-rβ The requested operation should reference the root set available via the target specifier.-t tidβ Specifies a thread id as the target of the operation.-x irqβ Specifies an irq as the target of the operation.
π¦ EXIT STATUS π¦
The cpuset utility exits 0 on success, and >0 if an error occurs. slay when it works, sad little number when it doesn't π.
π₯ EXAMPLES π₯
Create a new group with CPUs 0-4 inclusive and run /bin/sh on it:
cpuset -c -l 0-4 /bin/sh
Query the mask of CPUs the β¨sh pidβ© is allowed to run on:
cpuset -g -p <sh pid>
Restrict /bin/sh to run on CPUs 0 and 2 while its group is still allowed to run on CPUs 0-4:
cpuset -l 0,2 -p <sh pid>
Modify the cpuset /bin/sh belongs to, restricting it to CPUs 0 and 2:
cpuset -l 0,2 -c -p <sh pid>
Modify the cpuset all threads are in by default to contain only the first 4 CPUs, leaving the rest idle:
cpuset -l 0-3 -s 1
Print the id of the cpuset /bin/sh is in:
cpuset -g -i -p <sh pid>
Move the pid into the specified cpuset setid so it may be managed with other pids in that set:
cpuset -s <setid> -p <pid>
Create a new cpuset that is restricted to CPUs 0 and 2 and move pid into the new set:
cpuset -C -c -l 0,2 -p <pid>
π SEE ALSO π
nproc(1), cpuset(2), rctl(8) β go read the friends, bestie π«Ά
π HISTORY π
The cpuset command first appeared in FreeBSD 7.1. vintage but still iconic β¨
π AUTHORS π
Jeffrey Roberson <jeff@FreeBSD.org> β author credit, periodt π
okay that's the whole cpuset(1) vibe, bestie π signed off by Debian on July 3, 2018 β mwah π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2008 Christian Brueffer
- Copyright (c) 2008 Jeffrey Roberson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms