Macros to ANDNOT a bitset currently exist, but there are no ORNOT
equivalents. Introduce ORNOT macros for bitset(9), cpuset(9), and
domainset(9).
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I have a cpuset that represents the cpus used by a set of programs. Each 1 in the cpuset represents a taken cpu, each 0 represents an open cpu.
I want some programs to reserve cpus in a certain numa domain, so I use cpuset_getaffinity() with CPU_WHICH_DOMAIN to get the cpus in a certain domain.
I then use BIT_ORNOT2(CPU_SETSIZE, &domain_set, &master_set, &domain_set) which:
- finds all cpus that are not in the numa domain: ~domain_set.
- ORs it with the master set
- places the result in the domain_set.
This gives me a cpuset with 1s representing either taken cpus or cpus that are not in the numa domain and 0s representing open cpus.
I then loop over this bitset and find the first 0, which is my cpu to take.