CPU Mask
include/structures/cpu_mask.h View source View on GitHubFunctions
Section titled “Functions”cpu_mask_init
Section titled “cpu_mask_init”cpu_mask_create
Section titled “cpu_mask_create”cpu_mask_free
Section titled “cpu_mask_free”cpu_mask_copy
Section titled “cpu_mask_copy”cpu_mask_set
Section titled “cpu_mask_set”cpu_mask_of
Section titled “cpu_mask_of”Mask with only cpu set, usable as a runtime initializer
cpu_mask_clear
Section titled “cpu_mask_clear”cpu_mask_toggle
Section titled “cpu_mask_toggle”cpu_mask_test
Section titled “cpu_mask_test”cpu_mask_test_and_set
Section titled “cpu_mask_test_and_set”cpu_mask_test_and_clear
Section titled “cpu_mask_test_and_clear”cpu_mask_set_atomic
Section titled “cpu_mask_set_atomic”cpu_mask_clear_atomic
Section titled “cpu_mask_clear_atomic”cpu_mask_toggle_atomic
Section titled “cpu_mask_toggle_atomic”cpu_mask_test_atomic
Section titled “cpu_mask_test_atomic”cpu_mask_test_and_set_atomic
Section titled “cpu_mask_test_and_set_atomic”cpu_mask_test_and_clear_atomic
Section titled “cpu_mask_test_and_clear_atomic”cpu_mask_clear_all
Section titled “cpu_mask_clear_all”cpu_mask_zero
Section titled “cpu_mask_zero”cpu_mask_fill
Section titled “cpu_mask_fill”cpu_mask_set_range
Section titled “cpu_mask_set_range”cpu_mask_clear_range
Section titled “cpu_mask_clear_range”cpu_mask_or
Section titled “cpu_mask_or”cpu_mask_or2
Section titled “cpu_mask_or2”cpu_mask_and
Section titled “cpu_mask_and”cpu_mask_xor
Section titled “cpu_mask_xor”cpu_mask_andnot
Section titled “cpu_mask_andnot”cpu_mask_intersects
Section titled “cpu_mask_intersects”cpu_mask_equal
Section titled “cpu_mask_equal”cpu_mask_subset
Section titled “cpu_mask_subset”cpu_mask_popcount
Section titled “cpu_mask_popcount”cpu_mask_weight
Section titled “cpu_mask_weight”cpu_mask_empty
Section titled “cpu_mask_empty”cpu_mask_full
Section titled “cpu_mask_full”cpu_mask_first_set
Section titled “cpu_mask_first_set”cpu_mask_first_clear
Section titled “cpu_mask_first_clear”cpu_mask_next_set
Section titled “cpu_mask_next_set”cpu_mask_next_clear
Section titled “cpu_mask_next_clear”Macros
Section titled “Macros”CPU_MASK_BITS
Section titled “CPU_MASK_BITS”#define CPU_MASK_BITS 128 source CPU_MASK_WORD_BITS
Section titled “CPU_MASK_WORD_BITS”#define CPU_MASK_WORD_BITS 64 source CPU_MASK_WORDS
Section titled “CPU_MASK_WORDS”#define CPU_MASK_WORDS BITMAP_WORDS_CONST(CPU_MASK_BITS) source CPU_MASK_INIT
Section titled “CPU_MASK_INIT”#define CPU_MASK_INIT source Expansion
#define CPU_MASK_INIT \
(struct cpu_mask) { \
.bits = {0} \
} CPU_MASK_LAST_WORD_BITS
Section titled “CPU_MASK_LAST_WORD_BITS”#define CPU_MASK_LAST_WORD_BITS ((CPU_MASK_BITS) % CPU_MASK_WORD_BITS) source CPU_MASK_INIT_ALL
Section titled “CPU_MASK_INIT_ALL”#define CPU_MASK_INIT_ALL source Expansion
#define CPU_MASK_INIT_ALL \
cc_wno_override_init_expr( \
struct cpu_mask, \
((struct cpu_mask) { \
.bits = { \
[0 ...(CPU_MASK_WORDS - 1)] = ~(bitmap_word_t) 0, \
[CPU_MASK_WORDS - 1] = \
(CPU_MASK_LAST_WORD_BITS == 0) \
? ~(bitmap_word_t) 0 \
: (((bitmap_word_t) 1 << CPU_MASK_LAST_WORD_BITS) - \
1)}})) CPU_MASK_ERR
Section titled “CPU_MASK_ERR”#define CPU_MASK_ERR(e) source Used to overload cpu_mask to carry an error at times
Expansion
#define CPU_MASK_ERR(e) \
(struct cpu_mask) { \
.bits = {(bitmap_word_t) (e) } \
} cpu_mask_active_bits
Section titled “cpu_mask_active_bits”#define cpu_mask_active_bits source Expansion
#define cpu_mask_active_bits \
(global.core_count && global.core_count <= CPU_MASK_BITS \
? global.core_count \
: CPU_MASK_BITS) cpu_mask_set_all
Section titled “cpu_mask_set_all”#define cpu_mask_set_all(m) source Expansion
#define cpu_mask_set_all(m) bitmap_fill((m)->bits, cpu_mask_active_bits) for_each_cpu
Section titled “for_each_cpu”#define for_each_cpu(cpu, mask_ptr) source Expansion
#define for_each_cpu(cpu, mask_ptr) \
for ((cpu) = \
bitmap_find_first_set((mask_ptr)->bits, cpu_mask_active_bits); \
(cpu) < cpu_mask_active_bits; \
(cpu) = bitmap_find_next_bit((mask_ptr)->bits, cpu_mask_active_bits, \
(cpu) + 1)) cpu_mask_for_each
Section titled “cpu_mask_for_each”#define cpu_mask_for_each(iter, mask) source Expansion
#define cpu_mask_for_each(iter, mask) \
for (iter = 0; iter < cpu_mask_active_bits; iter++) \
if (bitmap_test((mask).bits, iter)) cpu_mask_for_each_atomic
Section titled “cpu_mask_for_each_atomic”#define cpu_mask_for_each_atomic(iter, mask) source Expansion
#define cpu_mask_for_each_atomic(iter, mask) \
for (iter = 0; iter < cpu_mask_active_bits; iter++) \
if (bitmap_atomic_test((mask).bits, iter)) cpu_mask_for_each_clear
Section titled “cpu_mask_for_each_clear”#define cpu_mask_for_each_clear(iter, mask) source Expansion
#define cpu_mask_for_each_clear(iter, mask) \
for (iter = 0; iter < cpu_mask_active_bits; iter++) \
if (!bitmap_test((mask).bits, iter)) cpu_mask_for_all
Section titled “cpu_mask_for_all”#define cpu_mask_for_all(iter, mask) source Expansion
#define cpu_mask_for_all(iter, mask) \
for (iter = 0; iter < cpu_mask_active_bits; iter++) cpu_mask_for_each_in
Section titled “cpu_mask_for_each_in”#define cpu_mask_for_each_in(iter, mask, start, end) source Expansion
#define cpu_mask_for_each_in(iter, mask, start, end) \
for (iter = (start); iter < cpu_mask_active_bits && iter <= (end); iter++) \
if (bitmap_test((mask).bits, iter)) cpu_mask_for_each_clear_in
Section titled “cpu_mask_for_each_clear_in”#define cpu_mask_for_each_clear_in(iter, mask, start, end) source Expansion
#define cpu_mask_for_each_clear_in(iter, mask, start, end) \
for (iter = (start); iter < cpu_mask_active_bits && iter <= (end); iter++) \
if (!bitmap_test((mask).bits, iter))