stop_one_cpu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, we're in the Kernel API Manual and this whole page is about stop_one_cpu(9) β€” yes, the one that stops a cpu πŸ›‘βœ¨ buckle up.

πŸ’– NAME πŸ’–

stop_one_cpu β€” stop a cpu πŸ›‘πŸ‘‘

πŸŽ€ SYNOPSIS πŸŽ€

int stop_one_cpu (unsigned int cpu , cpu_stop_fn_t fn , void *arg );

🌸 ARGUMENTS 🌸

  • cpu β€” the cpu to stop πŸ›‘
  • fn β€” the function to execute ✨
  • arg β€” the argument passed to fn 🎁

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: execute fn(arg) on cpu πŸ’…. fn runs in a process context, at the highest priority, preempting any task on the cpu and straight-up monopolizing it πŸ‘‘. This function returns after the execution is complete, periodt.

⚠️ Important vibe check: this function does not guarantee that cpu stays online till fn completes. If cpu goes down in the middle, execution may happen partially or fully on different cpus 😭. So fn should either be ready for that, or the caller should make sure cpu stays online until this function completes. no cap.

😴 CONTEXT 😴

Might sleep. literally allowed to snooze πŸ’€

πŸ’« RETURN πŸ’«

  • -ENOENT if fn(arg) was not executed because cpu was offline 😬
  • otherwise, the return value of fn 🫢

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./kernel/stop_machine.c β€” go peek bestie πŸ‘€. Also check out stop_two_cpus(9), stop_one_cpu_nowait(9), stop_cpus(9), and stop_machine_from_inactive_cpu(9) 🌈


source/version: ./kernel Β· date: October 2026 Β· page: stop_one_cpu(9) β€” byeee bestie, go stop a cpu responsibly πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from