bpf_cpumask_...d_distribute(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_cpumask_...d_distribute(9) β€” like, the Kernel API Manual page, bestie ✨

okay so real talk, this is a page straight out of the Kernel API Manual, and the function name is literally truncated with dots in the title (bpf_cpumask_...d_distribute) β€” that's not me being lazy, that's just how the header came, no cap πŸ™ˆ.


🌸 NAME 🌸

bpf_cpumask_any_and_distribute β€” returns a random set CPU from the AND of two cpumasks. that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

__bpf_kfunc u32 bpf_cpumask_any_and_distribute (const struct cpumask
*src1 , const struct cpumask *src2 );

she takes two cpumask pointers and hands you back a u32, periodt πŸ’…


🫢 ARGUMENTS 🫢

  • src1 β€” the first cpumask. yes, the first one bestie, we're doing both πŸ¦‹
  • src2 β€” the second cpumask. the other half of the AND, iconic duo behavior πŸ‘‘

πŸ”₯ RETURN πŸ”₯

  • 🎲 a random set bit within [0, num_cpus), taken from the AND of the two cpumasks β€” but only if at least one bit is set. so you get a valid answer, lucky you ✨
  • πŸ’€ >= num_cpus if no bit is set. that's the "nothing here, bestie" signal β€” check for it, fr fr.
lowkey important: that >= num_cpus case is your "empty" flag. don't sleep on the vibe check 🚨

πŸ’– DESCRIPTION πŸ’–

struct bpf_cpumask pointers may be safely passed to src1 and src2. that's it, that's the whole tea β€” safe to hand over, no drama 🌈


🧚 SEE ALSO 🧚

kernel file: ./kernel/bpf/cpumask.c, plus the whole friend group: 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_first_and(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_weight(9), bpf_cpumask_populate(9) 🌟

like, literally the entire cpumask friend group, they all ate πŸ’…


that's the page!! mwah 🫢 this little number lives in ./kernel/bpf and it's dated October 2026 β€” see you in the future, bestie β­πŸ’œ

πŸ“¦ where this page comes from