Skip to content

Commit b4d6510

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 a12a498 commit b4d6510

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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;
@@ -853,7 +847,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
853847
run_remote = false;
854848
}
855849

856-
if (run_local) {
850+
/* Check if we need local execution. */
851+
if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
852+
(!cond_func || cond_func(this_cpu, info))) {
857853
unsigned long flags;
858854

859855
local_irq_save(flags);

0 commit comments

Comments
 (0)