smp_call_function_any(9)
π NAME π
smp_call_function_any(9) β okay bestie, this is literally βRun a function on any of the given cpus,β no cap. The manual page is from the Kernel API Manual, and itβs here to help you pick a CPU and run your function on it. β¨
β¨ SYNOPSIS β¨
int smp_call_function_any (const struct cpumask *mask , smp_call_func_t
func , void *info , int wait );
π ARGUMENTS π
maskβ The mask of cpus it can run on. Itβs giving βthese are the allowed CPUsβ energy. πfuncβ The function to run. This must be fast and non-blocking. Seriously, bestie, fast and non-blocking is the vibe check here. β‘infoβ An arbitrary pointer to pass to the function. Itβs just your little note to hand over. π«Άwaitβ If true, wait until function has completed. If youβre the patient main character, this is for you. π
πΈ DESCRIPTION πΈ
Selection preference, in this exact order:
- current cpu if in mask
- nearest cpu in mask, based on NUMA topology
So the picker is like, βcurrent CPU first if itβs allowed, otherwise closest CPU by NUMA topology.β Lowkey iconic CPU matchmaking. π§
π₯ RETURN π₯
0 on success, else a negative status code (if no cpus were online). So if nobodyβs home CPU-wise, you get a negative status code and not a happy little zero. π
π¦ SEE ALSO π¦
Kernel file ./kernel/smp.c, plus the whole friend group: 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_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), smp_call_on_cpu(9). Go read them, iykyk. π
xoxo, signed off by the source/version bestie ./kernel, dated October 2026 πβ¨π
π¦ 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