Skip to content

Commit c20d36c

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
riscv: don't probe unaligned access speed if already done
If misaligned_access_speed percpu var isn't so called "HWPROBE MISALIGNED UNKNOWN", it means the probe has happened(this is possible for example, hotplug off then hotplug on one cpu), and the percpu var has been set, don't probe again in this case. Signed-off-by: Jisheng Zhang <[email protected]> Fixes: 584ea65 ("RISC-V: Probe for unaligned access speed") Reviewed-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 0786387 commit c20d36c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/riscv/kernel/cpufeature.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ void check_unaligned_access(int cpu)
572572
if (check_unaligned_access_emulated(cpu))
573573
return;
574574

575+
/* We are already set since the last check */
576+
if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_UNKNOWN)
577+
return;
578+
575579
page = alloc_pages(GFP_NOWAIT, get_order(MISALIGNED_BUFFER_SIZE));
576580
if (!page) {
577581
pr_warn("Can't alloc pages to measure memcpy performance");

0 commit comments

Comments
 (0)