From: Nick Piggin <npiggin@suse.de>
To: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: lkml <linux-kernel@vger.kernel.org>, mk <michael.kerrisk@gmail.com>
Subject: Re: MAP_POPULATE behavior change?
Date: Mon, 5 May 2008 14:54:50 +0200 [thread overview]
Message-ID: <20080505125450.GB10312@wotan.suse.de> (raw)
In-Reply-To: <cfd18e0f0805050542w20bee7f5v8b6125c8b399e63b@mail.gmail.com>
On Mon, May 05, 2008 at 02:42:44PM +0200, Michael Kerrisk wrote:
> Hi Nick,
>
> On Mon, May 5, 2008 at 2:23 PM, Nick Piggin <npiggin@suse.de> wrote:
> > On Mon, Apr 28, 2008 at 02:07:17PM +0200, Michael Kerrisk wrote:
>
> > > In 2.6.23, you had the commit below, which seems to have changed the
> > > kernel-userland API.
> > >
> > > Am I right to understand that with this patch MAP_POPULATE now also works with
> > > MAP_PRIVATE mappings? (Formerly it only worked with MAP_SHARED mappings, but
> > > some very quick testing suggests that MAP_POPULATE now also has an affect for
> > > MAP_PRIVATE.)
> >
> > Yeah it should also set up anonymous mappings. Very observant :)
>
> Umm -- did it not work for anonymous *shared* mappings before? I
> understood that it did.
Oh... yeah it would have. anonymous shared mappings aren't really anonymous
from the POV of most of mm/ :P
> > > Also, can you summarize the status of MAP_NONBLOCK? Is it now a no-op?
> >
> > Yes, it is.
>
> Hmm -- going back and re-reading the code, there is:
>
> if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
> make_pages_present(addr, addr + len);
>
> That means that MAP_NONBLOCK makes *MAP_POPULATE* a no-op. Was that intended?
Ah, my logic wasn't up to scratch there. Yes of course MAP_NONBLOCK is not
a noop, but it makes MAP_POPULATE into a noop. So it still guarantees
that the call will not block and that the kernel will make some kind of
best effort to populate the mapping... for some values of "some kind of"
(ie. "nothing" ;)).
It's done this way of course so it is still safe to call MAP_NONBLOCK if you
don't want to block, and thus everything stays backwards and forward
compatible.
Thanks,
Nick
next prev parent reply other threads:[~2008-05-05 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 12:07 Michael Kerrisk
2008-05-05 12:23 ` Nick Piggin
2008-05-05 12:42 ` Michael Kerrisk
2008-05-05 12:54 ` Nick Piggin [this message]
2008-05-05 15:27 ` Michael Kerrisk
-- strict thread matches above, loose matches on Subject: below --
2008-04-22 13:16 Michael Kerrisk
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=20080505125450.GB10312@wotan.suse.de \
--to=npiggin@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.kerrisk@gmail.com \
--cc=mtk.manpages@googlemail.com \
/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
all inboxes | Powered by JetHome®