smp_call_function_any(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:

  1. current cpu if in mask
  2. 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