summaryrefslogtreecommitdiff
path: root/kernel/smp.c
diff options
context:
space:
mode:
authorYury Norov [NVIDIA] <yury.norov@gmail.com>2025-06-22 20:00:09 -0400
committerThomas Gleixner <tglx@linutronix.de>2025-07-02 19:13:14 +0200
commite0e9506523fea415e0d5abaa103fd67dc8a39696 (patch)
tree619d4dfb848c6c87408cdd3e2022ca0d5c1c5332 /kernel/smp.c
parent976e0e3103e463725e19a5493d02ce7b7b380663 (diff)
smp: Defer check for local execution in smp_call_function_many_cond()
Defer check for local execution to the actual place where it is needed, which removes the extra local variable. Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250623000010.10124-5-yury.norov@gmail.com
Diffstat (limited to 'kernel/smp.c')
-rw-r--r--kernel/smp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/kernel/smp.c b/kernel/smp.c
index 5871acf3cd45..99d1fd0e9e0e 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -779,7 +779,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
bool wait = scf_flags & SCF_WAIT;
int nr_cpus = 0;
bool run_remote = false;
- bool run_local = false;
lockdep_assert_preemption_disabled();
@@ -801,11 +800,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
*/
WARN_ON_ONCE(!in_task());
- /* Check if we need local execution. */
- if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
- (!cond_func || cond_func(this_cpu, info)))
- run_local = true;
-
/* Check if we need remote execution, i.e., any CPU excluding this one. */
if (cpumask_any_and_but(mask, cpu_online_mask, this_cpu) < nr_cpu_ids) {
run_remote = true;
@@ -851,7 +845,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
send_call_function_ipi_mask(cfd->cpumask_ipi);
}
- if (run_local) {
+ /* Check if we need local execution. */
+ if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
+ (!cond_func || cond_func(this_cpu, info))) {
unsigned long flags;
local_irq_save(flags);