cpumask_last(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_last(9) β€” like, the last CPU standing πŸŽ€

okay bestie, welcome to the kernel API manual, section 9 (9 β€” kernel API, iykyk). today's main character is cpumask_last, and honestly? she's a tiny little function with one job and she does it. no notes. πŸ’–


✨ NAME ✨

cpumask_last β€” get the last CPU in a cpumask 🌸

like, the actual last one. the final girl. the one at the end of the bitmask. periodt.


✨ SYNOPSIS ✨

unsigned int cpumask_last (const struct cpumask *srcp );

that's it. that's the whole signature. she's not complicated, she's just focused. πŸ‘‘


✨ ARGUMENTS ✨

  • srcp β€” the cpumask pointer. literally just a pointer to the cpumask you want her to look at. hand her the mask, she finds the last set CPU in it. 🫢

✨ RETURN ✨

she gives you back >= nr_cpumask_bits if there are no CPUs set 😭

⚠️ okay this is the important bit, don't skip it β€” an empty mask does not get you a cute little 0 or a -1. you get a value that's >= nr_cpumask_bits, and that's your signal that there was nothing to find. check for it, bestie. fr fr.

✨ SEE ALSO ✨

the whole cpumask extended universe is right here, living in the kernel file ./include/linux/cpumask.h β€” go say hi to the fam πŸ’œ


that's the whole page, bestie, you ate that πŸ“ this lil drop came from ./include/linux and is dated October 2026 β€” so like, mark your calendar, this manual is lowkey from the future πŸ’…βœ¨ bye ily πŸ§šπŸ’–

πŸ“¦ where this page comes from