CPUMASK(9)

NAME
CPUMASK, ATOMIC_CPUMASK_COPY, ATOMIC_CPUMASK_NANDBIT, ATOMIC_CPUMASK_NANDMASK, ATOMIC_CPUMASK_ORBIT, ATOMIC_CPUMASK_ORMASK, ATOMIC_CPUMASK_TESTANDCLR, ATOMIC_CPUMASK_TESTANDSET, BSFCPUMASK, BSRCPUMASK, CPUMASK_ADDR, CPUMASK_ANDBIT, CPUMASK_ANDMASK, CPUMASK_ASSALLONES, CPUMASK_ASSBIT, CPUMASK_ASSBMASK, CPUMASK_ASSNBMASK, CPUMASK_ASSZERO, CPUMASK_CMPMASKEQ, CPUMASK_CMPMASKNEQ, CPUMASK_ISUP, CPUMASK_LOWMASK, CPUMASK_NANDBIT, CPUMASK_NANDMASK, CPUMASK_ORBIT, CPUMASK_ORMASK, CPUMASK_SIMPLE, CPUMASK_TESTBIT, CPUMASK_TESTMASK, CPUMASK_TESTNZERO, CPUMASK_TESTZERO, CPUMASK_XORMASK - Macros to manipulate cpumask_t fields

SYNOPSIS
#include <machine/cpumask.h>
ATOMIC_CPUMASK_COPY(mask, val);
ATOMIC_CPUMASK_NANDBIT(mask, i);
ATOMIC_CPUMASK_NANDMASK(mask, val);
ATOMIC_CPUMASK_ORBIT(mask, i);
ATOMIC_CPUMASK_ORMASK(mask, val);
ATOMIC_CPUMASK_TESTANDCLR(mask, i);
ATOMIC_CPUMASK_TESTANDSET(mask, i);
BSFCPUMASK(val);
BSRCPUMASK(val);
CPUMASK_ADDR(mask, cpu);
CPUMASK_ANDBIT(mask, i);
CPUMASK_ANDMASK(mask, val);
CPUMASK_ASSALLONES(mask);
CPUMASK_ASSBIT(mask, i);
CPUMASK_ASSBMASK(mask, i);
CPUMASK_ASSNBMASK(mask, i);
CPUMASK_ASSZERO(mask);
CPUMASK_CMPMASKEQ(mask1, mask2);
CPUMASK_CMPMASKNEQ(mask1, mask2);
CPUMASK_ISUP(val);
CPUMASK_LOWMASK(val);
CPUMASK_NANDBIT(mask, i);
CPUMASK_NANDMASK(mask, val);
CPUMASK_ORBIT(mask, i);
CPUMASK_ORMASK(mask, val);
CPUMASK_SIMPLE(cpu);
CPUMASK_TESTBIT(val, i);
CPUMASK_TESTMASK(mask1, mask2);
CPUMASK_TESTNZERO(val);
CPUMASK_TESTZERO(val);
CPUMASK_XORMASK(mask, val);

DESCRIPTION
The CPUMASK macros allow to safely manipulate the non standard type CPU bitmasks that uses CPUMASK_ELEMENTS of 64-bit words in cpumask_t type.

Declared CPU mask variables can be initialized using one of CPUMASK_INITIALIZER_ALLONES, CPUMASK_INITIALIZER_ONLYONE macros.

The BSFCPUMASK performs a "bit scan forward" assembler instruction over whole cpumask_t type, while the BSRCPUMASK performs a "bit scan reverse".

Keep in mind that macros like CPUMASK_SIMPLE might only work in 64-bit mask range as they are provided as a convenience to build more sophisticated macros.

The CPUMASK macros with ATOMIC prefix perform atomic(9) operations on the given CPU mask.

When adding, modifying or removing CPUMASK macros, it is important to be aware that these interfaces may be used by libraries, applications, users or documentation. Changing the cpumask_t length defined by CPUMASK_ELEMENTS requires adjustment of both CPUMASK macros and kernel assembly sources because CPUMASK are implemented as non variably-sized macros.