Re: [PATCH v4 4/6] io_uring: rsrc: avoid use of vmas parameter in pin_user_pages()
From: Jason Gunthorpe
Date: Thu Apr 20 2023 - 11:31:51 EST
On Thu, Apr 20, 2023 at 03:19:01PM +0100, Lorenzo Stoakes wrote:
> So I guess the question is, do you feel the requirement for vm_file being
> the same should apply across _any_ GUP operation over a range or is it
> io_uring-specific?
No need at all anywhere.
GUP's API contract is you get a jumble of pages with certain
properties. Ie normal GUP gives you a jumble of CPU cache coherent
struct pages.
The job of the GUP caller is to process this jumble.
There is no architectural reason to restrict it beyond that, and
io_uring has no functional need either.
The caller of GUP is, by design, not supposed to know about files, or
VMAs, or other MM details. GUP's purpose is to abstract that.
I would not object if io_uring demanded that all struct pages be in a
certain way, like all are P2P or something. But that is a *struct
page* based test, not a VMA test.
Checking VMAs is basically io_uring saying it knows better than GUP
and better than the MM on how this abstraction should work.
Jason