]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smp: Get this_cpu once in smp_call_function
authorShrikanth Hegde <sshegde@linux.ibm.com>
Mon, 23 Mar 2026 19:36:29 +0000 (01:06 +0530)
committerThomas Gleixner <tglx@kernel.org>
Wed, 25 Mar 2026 19:11:30 +0000 (20:11 +0100)
smp_call_function_single() and smp_call_function_many_cond() disable
preemption and cache the CPU number via get_cpu().

Use this cached value throughout the function instead of invoking
smp_processor_id() again.

[ tglx: Make the copy&pasta'ed change log match the patch ]

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Link: https://patch.msgid.link/20260323193630.640311-4-sshegde@linux.ibm.com
kernel/smp.c

index b179424f604013784575e45c820bf39908691ca6..bdbf145737baa0da97cb48bc69cf213c8673d087 100644 (file)
@@ -678,7 +678,7 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
        csd->func = func;
        csd->info = info;
 #ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
-       csd->node.src = smp_processor_id();
+       csd->node.src = this_cpu;
        csd->node.dst = cpu;
 #endif
 
@@ -833,7 +833,7 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
                        csd->func = func;
                        csd->info = info;
 #ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
-                       csd->node.src = smp_processor_id();
+                       csd->node.src = this_cpu;
                        csd->node.dst = cpu;
 #endif
                        trace_csd_queue_cpu(cpu, _RET_IP_, func, csd);