stop_cpus(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

stop_cpus(9) πŸŽ€

okay bestie, welcome to the Kernel API Manual page for stop_cpus β€” yes, the function name is literally right there, we move fast around here πŸ’…


🌸 NAME 🌸

stop_cpus β€” stop multiple cpus πŸ›‘

✨ SYNOPSIS ✨

int stop_cpus (const struct cpumask *cpumask , cpu_stop_fn_t fn , void
       *arg );

πŸŽ€ ARGUMENTS πŸŽ€

  • cpumask β€” cpus to stop πŸ›‘
  • fn β€” function to execute ✨
  • arg β€” argument to fn 🎁

πŸ¦‹ DESCRIPTION πŸ¦‹

Execute fn(arg) on online cpus in cpumask. On each target cpu, fn is run in a process context with the highest priority preempting any task on the cpu and monopolizing it. This function returns after all executions are complete. 😀

This function doesn't guarantee the cpus in cpumask stay online till fn completes. If some cpus go down in the middle, execution on the cpu may happen partially or fully on different cpus. fn should either be ready for that or the caller should ensure that the cpus stay online until this function completes. ⚠️

All stop_cpus calls are serialized making it safe for fn to wait for all cpus to start executing it. πŸ”’

πŸ’€ CONTEXT πŸ’€

Might sleep. 😴

⭐ RETURN ⭐

  • -ENOENT if fn(arg) was not executed at all because all cpus in cpumask were offline; otherwise, 0 if all executions of fn returned 0, any non zero return value if any returned non zero. πŸ’–

🌈 SEE ALSO 🌈

Kernel file ./kernel/stop_machine.c β€” go check out stop_one_cpu(9), stop_two_cpus(9), stop_one_cpu_nowait(9), and stop_machine_from_inactive_cpu(9). 🫢


🫢 that's the whole page, bestie β€” straight from the ./kernel source, dated October 2026, and it's stop_cpus(9) all the way down. πŸ’–

πŸ“¦ where this page comes from