[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-99e5afcf-d8c7-4660-a9e7-eb515e9aa55b@palmerdabbelt-glaptop1>
Date: Thu, 25 Jun 2020 14:27:50 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: Atish Patra <Atish.Patra@....com>
CC: linux-kernel@...r.kernel.org, greentime.hu@...ive.com,
Atish Patra <Atish.Patra@....com>, aou@...s.berkeley.edu,
anup@...infault.org, linux-riscv@...ts.infradead.org,
Paul Walmsley <paul.walmsley@...ive.com>
Subject: Re: [PATCH] RISC-V: Use a local variable instead of smp_processor_id()
On Mon, 22 Jun 2020 16:47:25 PDT (-0700), Atish Patra wrote:
> From: Greentime Hu <greentime.hu@...ive.com>
>
> Store the smp_processor_id() in a local variable to save some
> pointer chasing.
>
> Signed-off-by: Greentime Hu <greentime.hu@...ive.com>
> Signed-off-by: Atish Patra <atish.patra@....com>
> ---
> arch/riscv/kernel/smpboot.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> index 4e9922790f6e..3e033e97dd08 100644
> --- a/arch/riscv/kernel/smpboot.c
> +++ b/arch/riscv/kernel/smpboot.c
> @@ -146,6 +146,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
> asmlinkage __visible void smp_callin(void)
> {
> struct mm_struct *mm = &init_mm;
> + unsigned int curr_cpuid = smp_processor_id();
>
> if (!IS_ENABLED(CONFIG_RISCV_SBI))
> clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id()));
> @@ -155,9 +156,9 @@ asmlinkage __visible void smp_callin(void)
> current->active_mm = mm;
>
> trap_init();
> - notify_cpu_starting(smp_processor_id());
> - update_siblings_masks(smp_processor_id());
> - set_cpu_online(smp_processor_id(), 1);
> + notify_cpu_starting(curr_cpuid);
> + update_siblings_masks(curr_cpuid);
> + set_cpu_online(curr_cpuid, 1);
> /*
> * Remote TLB flushes are ignored while the CPU is offline, so emit
> * a local TLB flush right now just in case.
Thanks. This is on for-next.
Powered by blists - more mailing lists