From: Hugh Dickins <hughd@google.com>
To: Roland Dreier <roland@kernel.org>
Cc: linux-rdma@vger.kernel.org,
Andrea Arcangeli <aarcange@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC G-U-P experts] IB/umem: Modernize our get_user_pages() parameters
Date: Fri, 27 Jan 2012 18:31:07 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.00.1201271819260.3402@eggly.anvils> (raw)
In-Reply-To: <CAL1RGDVBR49QrAbkZ0Wa9Gh98HTwjtsQbFQ4Ws3Ra7rEjT1Mng@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2193 bytes --]
On Fri, 27 Jan 2012, Roland Dreier wrote:
> > Sigh, what a mess ... it seems what we really want to do is know
> > if userspace might trigger a COW because or not, and only do a
> > preemptive COW in that case. (We're not really concerned with
> > userspace fork()ing and setting up a COW in the future, since that's
> > what we have MADV_DONTFORK for)
> >
> > The status quo works for userspace anonymous mappings but
> > it doesn't work for my case of mapping a kernel buffer read-only
> > into userspace. And fixing my case breaks the anonymous case.
> > Do you see a way out of this dilemma? Do we need to add yet
> > another flag to get_user_pages()?
>
> So thinking about this a bit more... it seems what we want is at least
> to first order that we do the equivalent of write==1 exactly when the vma
> for a mapping has VM_WRITE set
My first impression is that that's not what you want at all: that will
not do a preliminary COW of anonymous page to be written into by the
driver when the user only wants VM_READ access. But perhaps I'm
worrying about the second order while you're sticking to first order.
Or perhaps I'm misunderstanding the context in which you want to do
this: are you now accepting to do a different get_user_pages in the
anonymous and driver-memory cases, and this suggestion was for the
driver-memory case only?
> (or is it VMA_MAYWRITE / force==1?
> I don't quite understand the distinction between WRITE and MAYWRITE).
I may have told you more than you wanted to know in the other mail.
>
> Right now, one call to get_user_pages() might involve more than one vma,
> but we could simulate the above by doing find_vma() and making sure our
> call to get_user_pages() goes one vma at a time. Of course that would be
> inefficient since get_user_pages() will redo the find_vma() internally, so it
> would I guess make sense to add another FOLL_ flag to tell
> get_user_pages() to do this?
I cannot go further, without explanation for why you need get_user_pages
in the driver-memory case at all.
>
> Am I all wet, or am I becoming an MM hacker?
Certainly more than I'll ever be an RDMA hacker,
Hugh
next prev parent reply other threads:[~2012-01-28 2:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 5:59 Roland Dreier
2012-01-26 20:01 ` Hugh Dickins
2012-01-26 22:45 ` Roland Dreier
2012-01-27 17:28 ` Roland Dreier
2012-01-28 2:31 ` Hugh Dickins [this message]
2012-01-28 19:25 ` Jason Gunthorpe
2012-01-30 19:19 ` Roland Dreier
2012-01-28 2:19 ` Hugh Dickins
2012-01-30 19:16 ` Roland Dreier
2012-01-30 20:20 ` Andrea Arcangeli
2012-02-06 17:46 ` Roland Dreier
2012-01-30 20:34 ` Hugh Dickins
2012-02-06 17:39 ` Roland Dreier
2012-02-07 20:39 ` Hugh Dickins
2012-02-08 23:10 ` Hugh Dickins
2012-02-09 17:50 ` Roland Dreier
2012-02-09 22:57 ` Hugh Dickins
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=alpine.LSU.2.00.1201271819260.3402@eggly.anvils \
--to=hughd@google.com \
--cc=aarcange@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=roland@kernel.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