From: Hugh Dickins <hugh@veritas.com>
To: "Eugene V. Lyubimkin" <jackyf.devel@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Peter Zijlstra <peterz@infradead.org>,
Chris Friesen <cfriesen@nortel.com>,
Rik van Riel <riel@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>
Subject: Re: mmap: is default non-populating behavior stable?
Date: Wed, 5 Nov 2008 16:42:22 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0811051613400.21353@blonde.site> (raw)
In-Reply-To: <49107D98.9080201@gmail.com>
On Tue, 4 Nov 2008, Eugene V. Lyubimkin wrote:
> Alan Cox wrote:
> >
> > I believe our behaviour is correct for mmap/mumap/truncate and it
> > certainly used to be and was tested.
Agreed.
> >
> > At the point you do anything involving mremap (which is non posix) our
> > behaviour becomes rather bizarre.
Certainly mremap is non-POSIX, but I can't think of any way in which
it would interfere with Eugene's assumptions about population.
(Every year or so we do wonder whether to change an extending mremap
of a MAP_SHARED|MAP_ANONYMOUS object to extend the object itself instead
of just SIGBUSing on the extension: but I've so far remained conservative
about that, and Eugene appears to be thinking of more ordinary files.)
>
> Thanks to all for answers. I have made the conclusion that doing "open() new
> file, truncate(<big size>), mmap(<the same big size>), write/read some memory
> pages" should not populate other, untouched by write/read pages (until
> MAP_POPULATE given), right?
That is a reasonable description of how the kernel tries and will always
try to handle it, approximately; but I don't think you can rely upon it
absolutely.
For a start, it depends on the filesystem: I believe that vfat, for
example, does not support the concept of sparse files (files with holes
in), so its truncate(<big size>) will allocate the whole of that big
size initially.
I'm not sure what you mean by "populate": in mm, as in MAP_POPULATE,
we're thinking of prefaulting pages into the user address space; but
you're probably thinking of whether the blocks are allocated on disk?
Prefaulting hole pages into the user address space may imply allocating
blocks on disk, or it may not: likely to depend on filesystem again.
>From time to time we toy with prefaulting adjacent pages when a fault
occurs (though IIRC tests have proved disappointing in the past): we'd
like to keep that option open, but it would go against your guidelines
above to some extent.
Hugh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-11-05 16:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <490F73CD.4010705@gmail.com>
2008-11-03 22:41 ` Peter Zijlstra
2008-11-03 22:49 ` Rik van Riel
2008-11-04 15:56 ` Chris Friesen
2008-11-04 16:07 ` Peter Zijlstra
2008-11-04 16:28 ` Alan Cox
2008-11-04 16:51 ` Eugene V. Lyubimkin
2008-11-05 16:42 ` Hugh Dickins [this message]
2008-11-05 16:54 ` Alan Cox
2008-11-05 17:50 ` Eugene V. Lyubimkin
2008-11-05 23:31 ` 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=Pine.LNX.4.64.0811051613400.21353@blonde.site \
--to=hugh@veritas.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cfriesen@nortel.com \
--cc=jackyf.devel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=riel@redhat.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