cpumask_weight(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_weight(9) β€” the cpumask_weight page, bestie edition πŸŽ€

okay so this is a page from the Kernel API Manual, and it's genuinely one of the little icon functions you'll keep reaching for once you know it exists. no cap.


✨ NAME ✨

cpumask_weight β€” literally just counts the bits in *srcp. that's it. that's the whole gig. πŸ‘‘


🌸 SYNOPSIS 🌸

unsigned int cpumask_weight (const struct cpumask *srcp );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • srcp β€” the cpumask you want to count bits in. and yes, the bits are < nr_cpu_ids, so don't go expecting it to count random garbage past that. 🫢

πŸ’– RETURN πŸ’–

the count of bits set in *srcp. that's the number you get back. slay. ✨


🧚 SEE ALSO 🧚

this is the part where the friend group gets introduced, and honestly it's a big friend group. the kernel file this all lives in is ./include/linux/cpumask.h, and here's everyone:


lowkey the whole cpumask cinematic universe lives in ./include/linux/cpumask.h, so that's your main character location if you wanna go read more. πŸ“–

and that's the page!! brought to you by the Kernel API Manual, source path ./include/linux, dated October 2026, version cpumask_weight(9). go count some bits, bestie, you're gonna eat πŸ’…βœ¨

πŸ“¦ where this page comes from