on_each_cpu_cond_mask(9)
π on_each_cpu_cond_mask(9) β Kernel API Manual, section 9
okay bestie, buckle up. this is a page from the Kernel API Manual, and it's about yelling at a bunch of CPUs at once β but like, only the ones that pass the vibe check π«Ά
β¨ NAME β¨
on_each_cpu_cond_mask β Call a function on each processor for which the supplied function cond_func returns true, optionally waiting for all the required CPUs to finish. This may include the local processor. π
πΈ SYNOPSIS πΈ
void on_each_cpu_cond_mask (smp_cond_func_t cond_func , smp_call_func_t
func , void *info , bool wait , const struct cpumask *mask );
π ARGUMENTS π
cond_funcβ A callback function that is passed a cpu id and theinfoparameter. The function is called with preemption disabled. The function should return a boolean value indicating whether to IPI the specified CPU. so like, it's the bouncer at the club door π "you in? you not? boolean, babes."funcβ The function to run on all applicable CPUs. This must be fast and non-blocking. fr fr, no cap β do not be doing your whole slow little routine in here. πββοΈπ¨infoβ An arbitrary pointer to pass to both functions. a little gift bag π you hand to both of them.waitβ If true, wait untilfunctionhas completed on other CPUs. like standing at the door until everyone texts you back πmaskβ The set of cpus to run on (only runs on online subset). the guest list, but only the ones who actually showed up π
π¦ DESCRIPTION π¦
Target CPU selection and work queueing are done with preemption disabled. this is the protective shield okay π‘οΈ It protects against CPUs going offline, but not against CPUs coming online concurrently; newly online CPUs are not guaranteed to be seen or sent an IPI. so if a CPU clocks in late, bestie, nobody promised it gets an invite π
If wait is true, the final wait for remote completion happens after that preemption-disabled section. note the timing, it matters π₯
β οΈ You must not call this function with disabled interrupts or from a hardware interrupt handler or from a bottom half handler. like, absolutely not. that is not the vibe. do not do that. π
π SEE ALSO π
Kernel file ./kernel/smp.c and its little friends: 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), 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)
β¨ mwah, that's a wrap β¨ this icon came from the ./kernel source, version date October 2026, and it lives under on_each_cpu_cond_mask(9). go forth and IPI responsibly, iykyk π§π
π¦ 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