From: Hugh Dickins <hugh@veritas.com>
To: Carsten Otte <carsteno@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Nick Piggin <nickpiggin@yahoo.com.au>,
Linux Memory Management <linux-mm@kvack.org>,
Andrew Morton <akpm@osdl.org>, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [patch] mm: mremap correct rmap accounting
Date: Wed, 31 Jan 2007 16:31:31 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0701311600300.28314@blonde.wat.veritas.com> (raw)
In-Reply-To: <45C0A0B0.4030100@de.ibm.com>
On Wed, 31 Jan 2007, Carsten Otte wrote:
> Nasty. I got your point now, but as far as I can see we're still in-spec:
>
> MAP_PRIVATE
> Create a private copy-on-write mapping. Stores to the region do not
> affect the original file. It is unspecified whether changes made to
> the file after the mmap call are visible in the mapped region.
I agree that last sentence _appears_ to give you a let out. I believe
its intention is to address the case where one page has been faulted
in and written to by the app, the next page is unfaulted then modified
by some other means and then faulted into the app for the first time:
that page will contain the mods made to the underlying object, even
though they were made after the private copy of the previous page was
taken (which copy should never show later mods to the underlying object).
Whereas if the mapping were mmap'ed with MAP_LOCKED (or mlocked), all
pages would be faulted in immediately, and subsequent mods to the
underlying object never seen at all.
Whatever the wording, I don't know of any application which is happy
for the modifications it makes to a MAP_PRIVATE mapping to disappear
without warning - except when it actually asks for that behaviour by
calling madvise(start, len, MADV_DONTNEED).
>
> A fix could be to use my own empty page instead of the ZERO_PAGE for xip.
Exactly, that's what I was meaning. Just take care to do enough
but not too much locking when allocating that page: for example
if (!our_zero_page) {
allocate a zeroed page;
spin_lock;
if (!our_zero_page)
our_zero_page = page just allocated;
else
free page just allocted;
spin_unlock;
}
> At least we have different behavior with/without xip here, therefore I
> agree that this requires fixing.
Yes, if your testing shows that it really does behave as I suspect.
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:[~2007-01-31 16:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 14:19 Nick Piggin
2007-01-23 20:55 ` Hugh Dickins
2007-01-23 23:49 ` Nick Piggin
2007-01-29 3:31 ` Nick Piggin
2007-01-29 6:40 ` Andrew Morton
2007-01-29 6:57 ` Nick Piggin
2007-01-29 19:08 ` Hugh Dickins
2007-01-29 19:27 ` Linus Torvalds
2007-01-29 20:03 ` Andrew Morton
2007-01-29 20:18 ` Linus Torvalds
2007-01-29 21:27 ` Ralf Baechle
2007-01-29 20:10 ` Hugh Dickins
2007-01-29 20:22 ` Linus Torvalds
2007-01-29 20:38 ` Hugh Dickins
2007-01-29 21:24 ` Hugh Dickins
2007-01-30 1:00 ` Nick Piggin
2007-01-30 14:24 ` Carsten Otte
2007-01-30 16:41 ` Ralf Baechle
2007-01-30 17:35 ` Carsten Otte
2007-01-30 15:47 ` Carsten Otte
2007-01-30 22:04 ` Hugh Dickins
2007-01-31 13:51 ` Carsten Otte
2007-01-31 13:59 ` Carsten Otte
2007-01-31 16:31 ` Hugh Dickins [this message]
2007-02-01 16:21 ` Carsten Otte
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.0701311600300.28314@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=akpm@osdl.org \
--cc=carsteno@de.ibm.com \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=ralf@linux-mips.org \
--cc=torvalds@linux-foundation.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