[PATCH v2 0/2] riscv: access_ok() optimization

Samuel Holland samuel.holland at sifive.com
Wed Mar 27 07:38:11 PDT 2024


This series optimizes access_ok() by defining TASK_SIZE_MAX. At Alex's
suggestion, I also tried making TASK_SIZE constant (specifically by
making PGDIR_SHIFT a variable instead of a ternary expression, then
replacing the load with an immediate using ALTERNATIVE). This appeared
to slightly improve performance on some implementations (C906) but
regressed it on others (FU740). So I am leaving further optimizations to
a later series.

Changes in v2:
 - Add a patch removing PGDIR_SIZE_L3 and TASK_SIZE_MIN
 - Set TASK_SIZE_MAX to LONG_MAX to optimize the comparison
 - Reword the commit message

Samuel Holland (2):
  riscv: Remove PGDIR_SIZE_L3 and TASK_SIZE_MIN
  riscv: Define TASK_SIZE_MAX for __access_ok()

 arch/riscv/include/asm/pgtable-64.h | 2 --
 arch/riscv/include/asm/pgtable.h    | 3 +--
 2 files changed, 1 insertion(+), 4 deletions(-)

-- 
2.43.1




More information about the linux-riscv mailing list