cpumask_next_zero(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_next_zero(9) β€” a Kernel API Manual moment πŸŽ€

okay so bestie, this is the Kernel API Manual page for cpumask_next_zero, and it is exactly what it sounds like: it finds you the next unset CPU in a cpumask. she's the zero-hunting sister of cpumask_next, and honestly? iconic behavior. ✨


🌸 NAME 🌸

cpumask_next_zero β€” get the next unset cpu in a cpumask

like, she goes looking for a cpu that is not set. no cap. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int cpumask_next_zero (int n , const struct cpumask *srcp );

yes the spacing is like that, do not come for her, she's been through a lot 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • n β€” the cpu prior to the place to search (i.e. return will be > n). so she starts looking after this one. it's giving "not you, next". πŸ™ˆ
  • srcp β€” the cpumask pointer. this is the mask she's rummaging through, okay bestie, hand it over. 🫢

⭐ RETURN ⭐

>= nr_cpu_ids if no further cpus unset.

translation: if literally every cpu left in the mask is already set, she comes back with nr_cpu_ids or higher, which is your lil signal that there's nothing left to find. vibe check failed, the search is over, go home. πŸ’€

real talk though β€” >= nr_cpu_ids is the "no more cpus unset" sentinel, so check for it before you go indexing into anything, fr fr. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/cpumask.h, plus the whole entire cpumask family reunion β€” she brought everyone:

like I said. everyone. the whole group chat showed up to the function. πŸŽ‰


and that's the whole page, bestie πŸ’– this lil gem lives in ./include/linux and it's dated October 2026, so yeah, future girlie came through with the docs. catch you on cpumask_next_zero(9) β€” mwah πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from