for_each_cpu_from(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ for_each_cpu_from(9) ✨

okay so bestie, welcome to the Kernel API Manual β€” yes we're literally in the kernel docs today and honestly? iconic behavior. this page is about for_each_cpu_from, a macro that loops over CPUs starting from a given one, and it's giving very much "small but mighty" energy πŸ’…


🌸 NAME 🌸

for_each_cpu_from β€” iterate over CPUs present in @mask, from @cpu to the end of @mask.

like, that's the whole vibe fr fr πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

for_each_cpu_from (cpu , mask );

no cap, that's the exact call β€” parentheses, spaces and all 🫢


πŸ’– ARGUMENTS πŸ’–

  • cpu β€” the (optionally unsigned) integer iterator. yes bestie, it's the loop variable and the starting point, main character energy πŸ‘‘
  • mask β€” the cpumask pointer. this is the guest list of CPUs we're checking πŸ’Œ

πŸ”₯ DESCRIPTION πŸ”₯

so for_each_cpu_from walks over the CPUs that are present in @mask, starting at @cpu and going all the way to the end of @mask. simple, elegant, slays πŸ’…

the important bit though β€” after the loop, cpu is >= nr_cpu_ids. like, the iterator ends up past the end, that's just how it is, don't come for me, it's literally documented 😭

ngl this is the whole page, it's a small one, but every detail counts and we do NOT skip details here 🧚

🌈 SEE ALSO 🌈

okay this list is long and honestly kind of a serve, so buckle up bestie, we're going through all of them πŸ“

Kernel file ./include/linux/cpumask.h, plus:


and that's the whole page!! πŸ’œ

cute little sign-off: this one lives in ./include/linux, dated October 2026, and yes it's for_each_cpu_from(9) from the Kernel API Manual β€” go forth and iterate responsibly bestie 🌟
πŸ“¦ where this page comes from