[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4087551-c5d3-e82d-3c4e-dcfa476a971e@redhat.com>
Date: Mon, 17 Apr 2023 13:13:58 +0200
From: David Hildenbrand <david@...hat.com>
To: Lorenzo Stoakes <lstoakes@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 4/7] mm/gup: introduce the FOLL_SAME_FILE GUP flag
On 15.04.23 14:09, Lorenzo Stoakes wrote:
> This flag causes GUP to assert that all VMAs within the input range possess
> the same vma->vm_file. If not, the operation fails.
>
> This is part of a patch series which eliminates the vmas parameter from the
> GUP API, implementing the one remaining assertion within the entire kernel
> that requires access to the VMAs associated with a GUP range.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@...il.com>
[...]
> ---
> &start, &nr_pages, i,
> @@ -1595,7 +1603,7 @@ long faultin_vma_page_range(struct vm_area_struct *vma, unsigned long start,
> * We want to report -EINVAL instead of -EFAULT for any permission
> * problems or incompatible mappings.
> */
> - if (check_vma_flags(vma, gup_flags))
> + if (check_vma_flags(vma, vma->vm_file, gup_flags))
> return -EINVAL;
FOLL_SAME_FILE is never set here, just pass NULL instead of vma->vm_file.
As we're not allowing to drop the mmap lock, why can't io_uring simply
go over all VMAs once, after pinning succeeded, and make sure that the
files match (or even before pinning)?
In most cases, we're dealing with a single VMA only, it's not like the
common case is that io_uring pins accross 100s of VMAs.
So I really wonder if the GUP complexity is justified by something.
(removing the VMAs is certainly a welcome surprise -- as it doesn't make
any sense when used with FOLL_UNLOCKABLE).
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists