cpumask_next(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_next β€” get the next cpu in a cpumask

okay bestie, welcome to the Kernel API Manual (yes, that's the manual name, we're fancy here ✨) β€” this little page is all about cpumask_next(9), and honestly? it's giving "tiny function, big main character energy" πŸŽ€


🌸 SYNOPSIS 🌸

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

like, look at her. two args. no cap. πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • n β€” the cpu prior to the place to search, i.e. the return value is gonna be greater than n. so think of it as "start looking strictly after this one, bestie" πŸ™ˆ
  • srcp β€” the cpumask pointer. that's the mask we're snooping through πŸ’…

✨ RETURN ✨

returns a value >= nr_cpu_ids if there are no further cpus set 😭 β€” so if you get something that big, that's the universe (and the mask) telling you there's nothing left in there, periodt.


πŸ”₯ SEE ALSO πŸ”₯

it's in the kernel file ./include/linux/cpumask.h πŸ“ and omg the friend group is huge, here's literally everyone:

like I said. iconic. the whole clique showed up πŸ’€πŸ‘‘


heads up bestie: this page comes from ./include/linux and it's dated October 2026, so if you're citing it in a group chat, cite it with pride 🫢

and that's the whole page!! go find your next cpu, slay, and remember: cpumask_next(9) said what it said πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from