bpf_cpumask_first_and(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:


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