linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v3 4/7] mm/gup: introduce the FOLL_SAME_FILE GUP flag
Date: Mon, 17 Apr 2023 13:13:58 +0200	[thread overview]
Message-ID: <e4087551-c5d3-e82d-3c4e-dcfa476a971e@redhat.com> (raw)
In-Reply-To: <2feedd2bad6fd1ec4bc4639f9d9012c5ae2faf1f.1681558407.git.lstoakes@gmail.com>

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@gmail.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



  reply	other threads:[~2023-04-17 11:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15 12:09 [PATCH v3 0/7] remove the vmas parameter from GUP APIs Lorenzo Stoakes
2023-04-15 12:09 ` [PATCH v3 1/7] mm/gup: remove unused vmas parameter from get_user_pages() Lorenzo Stoakes
2023-04-17 10:55   ` David Hildenbrand
2023-04-15 12:09 ` [PATCH v3 2/7] mm/gup: remove unused vmas parameter from pin_user_pages_remote() Lorenzo Stoakes
2023-04-17 10:55   ` David Hildenbrand
2023-04-15 12:09 ` [PATCH v3 3/7] mm/gup: remove vmas parameter from get_user_pages_remote() Lorenzo Stoakes
2023-04-17 10:52   ` Catalin Marinas
2023-04-17 11:01   ` David Hildenbrand
2023-04-15 12:09 ` [PATCH v3 4/7] mm/gup: introduce the FOLL_SAME_FILE GUP flag Lorenzo Stoakes
2023-04-17 11:13   ` David Hildenbrand [this message]
2023-04-17 11:27     ` Lorenzo Stoakes
2023-04-15 12:09 ` [PATCH v3 5/7] io_uring: rsrc: use FOLL_SAME_FILE on pin_user_pages() Lorenzo Stoakes
2023-04-15 12:09 ` [PATCH v3 6/7] mm/gup: remove vmas parameter from pin_user_pages() Lorenzo Stoakes
2023-04-17 11:14   ` David Hildenbrand
2023-04-17 11:59   ` Dennis Dalessandro
2023-04-15 12:09 ` [PATCH v3 7/7] mm/gup: remove vmas array from internal GUP functions Lorenzo Stoakes
2023-04-17 11:15   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4087551-c5d3-e82d-3c4e-dcfa476a971e@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).