for_each_cpu_wrap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to the for_each_cpu_wrap(9) page from the Kernel API Manual β€” it's giving elegant CPU-mask iterator energy, and honestly? iconic. ✨

🌸 NAME 🌸

for_each_cpu_wrap β€” iterate over every cpu in a mask, starting at a specified location. πŸŒ€

✨ SYNOPSIS ✨

for_each_cpu_wrap (cpu , mask , start );

πŸŽ€ ARGUMENTS πŸŽ€

  • cpu β€” the (optionally unsigned) integer iterator. she's the loop variable, bestie πŸ’…
  • mask β€” the cpumask pointer. the actual CPU guest list 🌈
  • start β€” the start location. where the wrap party begins πŸŽ‰

πŸ’… DESCRIPTION πŸ’…

okay so plot twist: the implementation does not assume any bit in mask is set (including start). no cap, not even the start bit is promised. πŸ™ˆ

after the loop, cpu is >= nr_cpu_ids. that's the after-party state, periodt. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/linux/cpumask.h β€” that's where this whole cpumask friend group lives 🫢

source/version: ./include/linux, date: October 2026 β€” this for_each_cpu_wrap(9) sign-off is out, mwah πŸ’–

πŸ“¦ where this page comes from