bpf_cpumask_first_and(9)
π bpf_cpumask_first_and(9) π
okay bestie, welcome to the Kernel API Manual β yes that Kernel API Manual, the one we all live in. today's main character is bpf_cpumask_first_and, and honestly? she's doing one tiny job and she's doing it immaculately. π
β¨ NAME β¨
bpf_cpumask_first_and β return the index of the first nonzero bit from the AND of two cpumasks. that's it. that's the whole gig. π¦
πΈ SYNOPSIS πΈ
__bpf_kfunc u32 bpf_cpumask_first_and (const struct cpumask *src1 ,
const struct cpumask *src2 );
like, look at her. __bpf_kfunc, returns a u32, takes two const struct cpumask *. no notes. π
π ARGUMENTS π
src1β the first cpumask. the OG. the one who goes first.src2β the second cpumask. the AND-partner in crime.
π DESCRIPTION π
so the whole vibe here is: take two cpumasks, AND them together (iykyk, bitwise, the classic), and find the index of the very first nonzero bit that comes out of that. it's giving "who's actually available in both of these sets" energy. π₯
and the best part? struct bpf_cpumask pointers may be safely passed to src1 and src2. no scary casting ritual required β you can just hand her the pointers and she'll be normal about it. π«Ά
β RETURN β
- the index of the first bit that is nonzero in both cpumask instances. that's the answer. that's the return value. periodt. π
π SEE ALSO π
this list is LONG, bestie. we're getting through all of it. hydrate, babe. π
kernel file ./kernel/bpf/cpumask.c, plus:
struct bpf_cpumask(9)bpf_cpumask_create(9)bpf_cpumask_acquire(9)bpf_cpumask_release(9)bpf_cpumask_first(9)bpf_cpumask_first_zero(9)bpf_cpumask_set_cpu(9)bpf_cpumask_clear_cpu(9)bpf_cpumask_test_cpu(9)bpf_cpumask_test_and_set_cpu(9)bpf_cpumask_test_and_clear_cpu(9)bpf_cpumask_setall(9)bpf_cpumask_clear(9)bpf_cpumask_and(9)bpf_cpumask_or(9)bpf_cpumask_xor(9)bpf_cpumask_equal(9)bpf_cpumask_intersects(9)bpf_cpumask_subset(9)bpf_cpumask_empty(9)bpf_cpumask_full(9)bpf_cpumask_copy(9)bpf_cpumask_any_distribute(9)bpf_cpumask_any_and_distribute(9)bpf_cpumask_weight(9)bpf_cpumask_populate(9)
and that's the page, bestie!! π this whole thing lives in ./kernel/bpf and it's stamped October 2026 in the Kernel API Manual β so go forth, AND those masks, find that first nonzero bit, and slay. 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