[PATCH] riscv/mm: Simplify retry logic in do_page_fault()

Palmer Dabbelt palmer at dabbelt.com
Thu Aug 20 23:32:15 EDT 2020


On Wed, 19 Aug 2020 07:10:11 PDT (-0700), penberg at gmail.com wrote:
> From: Pekka Enberg <penberg at kernel.org>
>
> Let's combine the two retry logic if statements in do_page_fault() to
> simplify the code.
> ---
>  arch/riscv/mm/fault.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
> index 716d64e36f83..f5c2e4a249eb 100644
> --- a/arch/riscv/mm/fault.c
> +++ b/arch/riscv/mm/fault.c
> @@ -127,17 +127,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
>  		BUG();
>  	}
>
> -	if (flags & FAULT_FLAG_ALLOW_RETRY) {
> -		if (fault & VM_FAULT_RETRY) {
> -			flags |= FAULT_FLAG_TRIED;
> -
> -			/*
> -			 * No need to mmap_read_unlock(mm) as we would
> -			 * have already released it in __lock_page_or_retry
> -			 * in mm/filemap.c.
> -			 */
> -			goto retry;
> -		}
> +	if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
> +		flags |= FAULT_FLAG_TRIED;
> +
> +		/*
> +		 * No need to mmap_read_unlock(mm) as we would
> +		 * have already released it in __lock_page_or_retry
> +		 * in mm/filemap.c.
> +		 */
> +		goto retry;
>  	}
>
>  	mmap_read_unlock(mm);

This is missing your Signed-off-by, and while it's a bit pedantic I can't add
it myself.  Otherwise

Reviewed-by: Palmer Dabbelt <palmerdabbelt at google.com>

Thanks!



More information about the linux-riscv mailing list