Skip to content

Commit e0e9506

Browse files
YuryNorovKAGA-KOKO
authored andcommitted
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
1 parent 976e0e3 commit e0e9506

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

kernel/smp.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
779779
bool wait = scf_flags & SCF_WAIT;
780780
int nr_cpus = 0;
781781
bool run_remote = false;
782-
bool run_local = false;
783782

784783
lockdep_assert_preemption_disabled();
785784

@@ -801,11 +800,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
801800
*/
802801
WARN_ON_ONCE(!in_task());
803802

804-
/* Check if we need local execution. */
805-
if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
806-
(!cond_func || cond_func(this_cpu, info)))
807-
run_local = true;
808-
809803
/* Check if we need remote execution, i.e., any CPU excluding this one. */
810804
if (cpumask_any_and_but(mask, cpu_online_mask, this_cpu) < nr_cpu_ids) {
811805
run_remote = true;
@@ -851,7 +845,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
851845
send_call_function_ipi_mask(cfd->cpumask_ipi);
852846
}
853847

854-
if (run_local) {
848+
/* Check if we need local execution. */
849+
if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
850+
(!cond_func || cond_func(this_cpu, info))) {
855851
unsigned long flags;
856852

857853
local_irq_save(flags);

0 commit comments

Comments
 (0)