HomeFreeBSD

cpuset: add --count

Description

cpuset: add --count

Can be used to count the number of hardware threads in the cpu set.

For example:
$ cpuset -g -p $$
pid 2440 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39
pid 2440 domain policy: first-touch mask: 0, 1
$ cpuset -g --count -p $$
40

The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus which
can be found in the tree, which are not adequate given existence of
cpusets.

Right now only -g -p combination is supported to reduce complexity.
As anything else errors out, this can be expanded later as needed.

Differential Revision: https://reviews.freebsd.org/D36351

Details

Provenance
mjgAuthored on Feb 4 2023, 5:47 PM
Differential Revision
D36351: cpuset: add --count
Parents
rGda6ae2cf1750: rtwm: purge EOL release compatibility
Branches
Unknown
Tags
Unknown
Reverted By
rG2924ae099a1e: Revert "cpuset: add --count"