[RFC PATCH RESEND 19/28] mm: disallow do_swap_page to handle page faults under VMA lock

Laurent Dufour ldufour at linux.ibm.com
Fri Sep 9 07:26:34 PDT 2022


Le 01/09/2022 à 19:35, Suren Baghdasaryan a écrit :
> Due to the possibility of do_swap_page dropping mmap_lock, abort fault
> handling under VMA lock and retry holding mmap_lock. This can be handled
> more gracefully in the future.
> 
> Signed-off-by: Suren Baghdasaryan <surenb at google.com>

Reviewed-by: Laurent Dufour <laurent.dufour at fr.ibm.com>

> ---
>  mm/memory.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 9ac9944e8c62..29d2f49f922a 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3738,6 +3738,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
>  	vm_fault_t ret = 0;
>  	void *shadow = NULL;
>  
> +	if (vmf->flags & FAULT_FLAG_VMA_LOCK) {
> +		ret = VM_FAULT_RETRY;
> +		goto out;
> +	}
> +
>  	if (!pte_unmap_same(vmf))
>  		goto out;
>  




More information about the linux-arm-kernel mailing list