cpuset: Add CPU_TEST_{SET,CLR}_ATOMIC
These are similar to CPU_{SET,CLR}_ATOMIC with the addition of
returning true if the CPU bit was set before the change.
Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51765
This commit is contained in:
+13
-1
@@ -22,7 +22,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd September 23, 2022
|
||||
.Dd August 7, 2025
|
||||
.Dt CPUSET 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -50,8 +50,10 @@
|
||||
.Nm CPU_ANDNOT ,
|
||||
.Nm CPU_XOR ,
|
||||
.Nm CPU_CLR_ATOMIC ,
|
||||
.Nm CPU_TEST_CLR_ATOMIC ,
|
||||
.Nm CPU_SET_ATOMIC ,
|
||||
.Nm CPU_SET_ATOMIC_ACQ ,
|
||||
.Nm CPU_TEST_SET_ATOMIC ,
|
||||
.Nm CPU_AND_ATOMIC ,
|
||||
.Nm CPU_OR_ATOMIC ,
|
||||
.Nm CPU_COPY_STORE_REL
|
||||
@@ -93,8 +95,10 @@
|
||||
.Fn CPU_XOR "cpuset_t *dst" "cpuset_t *src1" "cpuset_t *src2"
|
||||
.\"
|
||||
.Fn CPU_CLR_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
|
||||
.Fn CPU_TEST_CLR_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
|
||||
.Fn CPU_SET_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
|
||||
.Fn CPU_SET_ATOMIC_ACQ "size_t cpu_idx" "cpuset_t *cpuset"
|
||||
.Fn CPU_TEST_SET_ATOMIC "size_t cpu_idx" "cpuset_t *cpuset"
|
||||
.\"
|
||||
.Fn CPU_AND_ATOMIC "cpuset_t *dst" "cpuset_t *src"
|
||||
.Fn CPU_OR_ATOMIC "cpuset_t *dst" "cpuset_t *src"
|
||||
@@ -143,6 +147,10 @@ The
|
||||
.Fn CPU_CLR_ATOMIC
|
||||
macro is identical, but the bit representing the CPU is cleared with atomic
|
||||
machine instructions.
|
||||
The
|
||||
.Fn CPU_TEST_CLR_ATOMIC
|
||||
macro atomically clears the bit representing the CPU and returns whether it
|
||||
was set.
|
||||
.Pp
|
||||
The
|
||||
.Fn CPU_COPY
|
||||
@@ -176,6 +184,10 @@ machine instructions.
|
||||
The
|
||||
.Fn CPU_SET_ATOMIC_ACQ
|
||||
macro sets the bit representing the CPU with atomic acquire semantics.
|
||||
The
|
||||
.Fn CPU_TEST_SET_ATOMIC
|
||||
macro atomically sets the bit representing the CPU and returns whether it was
|
||||
set.
|
||||
.Pp
|
||||
The
|
||||
.Fn CPU_ISSET
|
||||
|
||||
@@ -61,8 +61,10 @@
|
||||
#define CPU_ANDNOT(d, s1, s2) __BIT_ANDNOT2(CPU_SETSIZE, d, s1, s2)
|
||||
#define CPU_XOR(d, s1, s2) __BIT_XOR2(CPU_SETSIZE, d, s1, s2)
|
||||
#define CPU_CLR_ATOMIC(n, p) __BIT_CLR_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_TEST_CLR_ATOMIC(n, p) __BIT_TEST_CLR_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_SET_ATOMIC(n, p) __BIT_SET_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_SET_ATOMIC_ACQ(n, p) __BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p)
|
||||
#define CPU_TEST_SET_ATOMIC(n, p) __BIT_TEST_SET_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_AND_ATOMIC(n, p) __BIT_AND_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_OR_ATOMIC(d, s) __BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
|
||||
#define CPU_COPY_STORE_REL(f, t) __BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
|
||||
|
||||
Reference in New Issue
Block a user