smp_call_on_cpu(9)
π smp_call_on_cpu(9) β the Kernel API Manual, bestie edition π
Okay so picture this: you've got a function, right? And you've got one specific CPU in mind. And you're like "girl, I need this to run there and I need to wait for it." That's literally this whole thing. It's smp_call_on_cpu from the Kernel API Manual, and it's giving "call a function on a specific CPU and wait for it to return." Main character energy, no cap. β¨
πΈ NAME πΈ
smp_call_on_cpu β Call a function on a specific CPU and wait for it to return.
β¨ SYNOPSIS β¨
int smp_call_on_cpu (unsigned int cpu , int (*func)(void *) , void *par
, bool phys );
π¦ ARGUMENTS π¦
cpuβ The CPU to run on. That's the whole vibe check: which CPU you're targeting. πfuncβ The function to run. The actual star of the show. πparβ An arbitrary pointer parameter forfunc. Like, whatever pointer you want to hand it β it's arbitrary, it's yours, it's giving "pass it through." π«Άphysβ Iftrue, force to run on physical cpu. Seestruct smp_call_on_cpu_structfor more info. So like,true= physical CPU, periodt. π
π RETURN π
-ENXIO if the cpu is invalid; otherwise the return value from func.
So if the CPU you picked is a no-go, you get -ENXIO back (rough). Otherwise you get whatever func decided to give you β literally just passing it through. π
Not me calling out that "otherwise" β yeah, the success path is just func's own return value. That's it. That's the whole deal. π
π§ SEE ALSO π§
Kernel file ./kernel/smp.c π and these iconic neighbors:
csd_lock_is_stuck(9)generic_smp_call_function_single_interrupt(9)__flush_smp_call_function_queue(9)flush_smp_call_function_queue(9)smp_call_function_single(9)smp_call_function_single_async(9)smp_call_function_any(9)smp_call_function_many(9)smp_call_function(9)on_each_cpu_cond_mask(9)kick_all_cpus_sync(9)wake_up_all_idle_cpus(9)cpus_peek_for_pending_ipi(9)struct smp_call_on_cpu_struct(9)
π that's the page, bestie π
Sign-off time π: this one lives in ./kernel, dated October 2026, and it's page smp_call_on_cpu(9) of the Kernel API Manual. Go run your function on a CPU and slay. ππΈπ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms