cpumask_nth_and(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cpumask_nth_and β€” kernel API manual, but make it cute

okay so bestie, you know how there's a whole family of cpumask functions and they all kinda blur together? yeah. this one is cpumask_nth_and, and it lives in the kernel API manual. it's the "give me the Nth cpu" girlie, but with a twist: she's only looking at the cpus that are in both masks. intersection core, no cap. πŸŽ€


🌸 NAME 🌸

cpumask_nth_and β€” get the Nth cpu in 2 cpumasks

like, literally. the Nth cpu that shows up in the intersection of two cpumasks. that's the whole vibe. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int cpumask_nth_and (unsigned int cpu , const struct cpumask
*srcp1 , const struct cpumask *srcp2 );

she takes a cpu, a srcp1 and a srcp2, and hands you back an unsigned int. it's giving "trust me bestie, I got the index." πŸ’œ


πŸ‘‘ ARGUMENTS πŸ‘‘

  • cpu β€” the Nth cpu to find, starting from 0. so if you want the very first one, you pass 0. zero-indexed like a good little array, periodt. πŸ’…
  • srcp1 β€” the cpumask pointer. one half of the intersection situation.
  • srcp2 β€” the cpumask pointer. the other half. together they're like, the main character duo. 🫢

πŸ”₯ RETURN πŸ”₯

>= nr_cpu_ids if such cpu doesn't exist.

translation: if you ask for an Nth cpu that isn't there, you don't get an error, you get a number that's >= nr_cpu_ids. so check it, bestie. don't just assume she found something. 😭


🌈 SEE ALSO 🌈

all her siblings and cousins, because this family is huge and we love her for it. the kernel file is ./include/linux/cpumask.h. 🧚


okay that's the whole page, no notes. this one's from ./include/linux, dated October 2026, and it's filed under the Kernel API Manual. go forth and find your Nth cpu, bestie. you're gonna slay. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from