mbox series

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

Message ID 20240327143858.711792-1-samuel.holland@sifive.com (mailing list archive)
Headers show
Series riscv: access_ok() optimization | expand

Message

Samuel Holland March 27, 2024, 2:38 p.m. UTC
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(-)

Comments

patchwork-bot+linux-riscv@kernel.org May 22, 2024, 2:10 p.m. UTC | #1
Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 27 Mar 2024 07:38:11 -0700 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2,1/2] riscv: Remove PGDIR_SIZE_L3 and TASK_SIZE_MIN
    https://git.kernel.org/riscv/c/9ad6bb3298d1
  - [v2,2/2] riscv: Define TASK_SIZE_MAX for __access_ok()
    https://git.kernel.org/riscv/c/ad5643cf2f69

You are awesome, thank you!