Re: [PATCH v2 1/6] mm: Make lock_folio_maybe_drop_mmap() VMA lock aware

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 6, 2023 at 12:53 PM Matthew Wilcox (Oracle)
<willy@xxxxxxxxxxxxx> wrote:
>
> Drop the VMA lock instead of the mmap_lock if that's the one which
> is held.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>

> ---
>  mm/filemap.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 9481ffaf24e6..a598872d62cc 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -3104,7 +3104,7 @@ static int lock_folio_maybe_drop_mmap(struct vm_fault *vmf, struct folio *folio,
>
>         /*
>          * NOTE! This will make us return with VM_FAULT_RETRY, but with
> -        * the mmap_lock still held. That's how FAULT_FLAG_RETRY_NOWAIT
> +        * the fault lock still held. That's how FAULT_FLAG_RETRY_NOWAIT
>          * is supposed to work. We have way too many special cases..
>          */
>         if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT)
> @@ -3114,13 +3114,14 @@ static int lock_folio_maybe_drop_mmap(struct vm_fault *vmf, struct folio *folio,
>         if (vmf->flags & FAULT_FLAG_KILLABLE) {
>                 if (__folio_lock_killable(folio)) {
>                         /*
> -                        * We didn't have the right flags to drop the mmap_lock,
> -                        * but all fault_handlers only check for fatal signals
> -                        * if we return VM_FAULT_RETRY, so we need to drop the
> -                        * mmap_lock here and return 0 if we don't have a fpin.
> +                        * We didn't have the right flags to drop the
> +                        * fault lock, but all fault_handlers only check
> +                        * for fatal signals if we return VM_FAULT_RETRY,
> +                        * so we need to drop the fault lock here and
> +                        * return 0 if we don't have a fpin.
>                          */
>                         if (*fpin == NULL)
> -                               mmap_read_unlock(vmf->vma->vm_mm);
> +                               release_fault_lock(vmf);
>                         return 0;
>                 }
>         } else
> --
> 2.40.1
>





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux