bpf_cpumask_...d_distribute(9)
π 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_cpusif 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
- 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