cpumask_any_andnot_but(9)
π cpumask_any_andnot_but(9) β from the Kernel API Manual, bestie π
okay so we're in the Kernel API Manual today and the star of the show is cpumask_any_andnot_but(9). she's a cpu picker. she's got opinions. let's go β¨
πΈ NAME πΈ
cpumask_any_andnot_but β pick an arbitrary cpu from *mask1 & ~*mask2, but not this one. π« like she's literally excluding one specific cpu from the whole situation, no cap.
β¨ SYNOPSIS β¨
unsigned int cpumask_any_andnot_but (const struct cpumask *mask1 , const
struct cpumask *mask2 , int cpu );
that's the whole signature, character for character, don't @ me π«Ά
π¦ ARGUMENTS π¦
mask1β the first input cpumask π one half of the equation.mask2β the second input cpumask π the other half, the one getting andnot-ed out.cpuβ the cpu to ignore π miss girl gets left on read.
π₯ DESCRIPTION π₯
so the vibe is: you give her two masks and a cpu to skip, and she hands you back a cpu. simple. iconic.
if cpu == -1, the function returns the first matching cpu. periodt. π
and she returns >= nr_cpu_ids if no cpus are set β so like, if there's literally nothing matching, you get a value that's out of range, which is your signal that the well was dry π no cpus for you.
ngl, always check that return value against nr_cpu_ids before you go using it as an actual cpu id. that's the whole warning, bestie, don't skip it π
π SEE ALSO π
she did NOT come alone. this is her whole friend group, and they all live in the kernel file ./include/linux/cpumask.h:
cpumask_pr_args(9),cpumask_first(9),cpumask_first_zero(9),cpumask_first_and(9),cpumask_first_andnot(9),cpumask_first_and_and(9),cpumask_last(9)cpumask_next(9),cpumask_next_zero(9),cpumask_next_and(9),cpumask_next_andnot(9),cpumask_next_and_wrap(9),cpumask_next_wrap(9),cpumask_random(9)for_each_cpu(9),for_each_cpu_wrap(9),for_each_cpu_and(9),for_each_cpu_andnot(9),for_each_cpu_or(9),for_each_cpu_from(9)cpumask_any_but(9),cpumask_any_and_but(9),cpumask_nth(9),cpumask_nth_and(9),cpumask_nth_and_andnot(9)cpumask_set_cpu(9),cpumask_clear_cpus(9),cpumask_clear_cpu(9),cpumask_test_cpu(9),cpumask_test_and_set_cpu(9),cpumask_test_and_clear_cpu(9)cpumask_setall(9),cpumask_clear(9),cpumask_and(9),cpumask_or(9),cpumask_weighted_or(9),cpumask_xor(9),cpumask_andnot(9)cpumask_equal(9),cpumask_or_equal(9),cpumask_intersects(9),cpumask_subset(9),cpumask_empty(9),cpumask_full(9)cpumask_weight(9),cpumask_weight_and(9),cpumask_weight_andnot(9),cpumask_shift_right(9),cpumask_shift_left(9),cpumask_copy(9)cpumask_any(9),cpumask_any_and(9),cpumask_of(9)cpumask_parse_user(9),cpumask_parselist_user(9),cpumask_parse(9),cpulist_parse(9),cpumask_size(9),alloc_cpumask_var(9),to_cpumask(9)num_online_cpus(9),cpumap_print_bitmask_to_buf(9),cpumap_print_list_to_buf(9)
like, that's the entire cpumask cinematic universe and she's in it π
okay that's the page!! source is ./include/linux, dated October 2026, and she's filed under cpumask_any_andnot_but(9) in the Kernel API Manual β go pick some cpus responsibly bestie, mwah π§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms