Skip to content

Commit 9850e73

Browse files
XiaoWang1772palmer-dabbelt
authored andcommitted
riscv: uaccess: Relax the threshold for fast path
The bytes copy for unaligned head would cover at most SZREG-1 bytes, so it's better to set the threshold as >= (SZREG-1 + word_copy stride size) which equals to 9*SZREG-1. Signed-off-by: Xiao Wang <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent f190594 commit 9850e73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/lib/uaccess.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SYM_FUNC_START(fallback_scalar_usercopy)
4444
* Use byte copy only if too small.
4545
* SZREG holds 4 for RV32 and 8 for RV64
4646
*/
47-
li a3, 9*SZREG /* size must be larger than size in word_copy */
47+
li a3, 9*SZREG-1 /* size must >= (word_copy stride + SZREG-1) */
4848
bltu a2, a3, .Lbyte_copy_tail
4949

5050
/*

0 commit comments

Comments
 (0)