cpumask_first(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_first(9) β€” the kernel API manual, bestie edition ✨

Okay so real talk, this page lives in the kernel API manual (section 9, iykyk) and it's about cpumask_first β€” the tiny little legend that finds you the very first cpu in a cpumask. Yeah. That's it. That's the whole gig. And honestly? She ate. πŸŽ€


🌸 NAME 🌸

cpumask_first β€” get the first cpu in a cpumask. literally just the first one, no drama ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int cpumask_first (const struct cpumask *srcp );

copy it exactly like that, spaces and all, bestie β€” the trailing space before that last paren is part of the vibe πŸ’…


πŸ’– ARGUMENTS πŸ’–

  • srcp β€” the cpumask pointer. it's the mask you're handing over so she can go find the first cpu in it. that's the whole assignment. 🫢

✨ RETURN ✨

She gives you back the first cpu. And if there are no cpus set at all? You get something >= nr_cpu_ids β€” which is your little signal that the mask was empty and there was nothing to find. no cap, that's the check 😭

⚠️ fr fr remember: >= nr_cpu_ids means empty mask, not a real cpu. always vibe-check the return value before you go using it as a cpu id. πŸ’€

🌈 SEE ALSO 🌈

The whole cpumask friend group showed up, and we're listing every single one of them because we don't do half-messages in this group chat πŸ’œ

Specifically: Kernel file ./include/linux/cpumask.h, plus β€”

like… the whole roster. iconic behavior, honestly πŸ‘‘


okay that's the whole page, you're officially a cpumask_first understander, go be the main character of your own scheduler 🧚

sign-off szn: this little masterpiece comes from ./include/linux (yes, the directory, she's humble) and it's dated October 2026. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from