Skip to content

Commit a2693fe

Browse files
greentimepalmer-dabbelt
authored andcommitted
RISC-V: Use a local variable instead of smp_processor_id()
Store the smp_processor_id() in a local variable to save some pointer chasing. Signed-off-by: Greentime Hu <[email protected]> Signed-off-by: Atish Patra <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 234e9d7 commit a2693fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/riscv/kernel/smpboot.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
146146
asmlinkage __visible void smp_callin(void)
147147
{
148148
struct mm_struct *mm = &init_mm;
149+
unsigned int curr_cpuid = smp_processor_id();
149150

150151
if (!IS_ENABLED(CONFIG_RISCV_SBI))
151152
clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id()));
@@ -155,9 +156,9 @@ asmlinkage __visible void smp_callin(void)
155156
current->active_mm = mm;
156157

157158
trap_init();
158-
notify_cpu_starting(smp_processor_id());
159-
update_siblings_masks(smp_processor_id());
160-
set_cpu_online(smp_processor_id(), 1);
159+
notify_cpu_starting(curr_cpuid);
160+
update_siblings_masks(curr_cpuid);
161+
set_cpu_online(curr_cpuid, 1);
161162
/*
162163
* Remote TLB flushes are ignored while the CPU is offline, so emit
163164
* a local TLB flush right now just in case.

0 commit comments

Comments
 (0)