linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Chris Friesen <cfriesen@nortel.com>,
	Rik van Riel <riel@redhat.com>,
	"Eugene V. Lyubimkin" <jackyf.devel@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	hugh <hugh@veritas.com>
Subject: Re: mmap: is default non-populating behavior stable?
Date: Tue, 4 Nov 2008 16:28:20 +0000	[thread overview]
Message-ID: <20081104162820.644b1487@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <1225814820.7803.1672.camel@twins>

On Tue, 04 Nov 2008 17:07:00 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, 2008-11-04 at 09:56 -0600, Chris Friesen wrote:
> > Rik van Riel wrote:
> > > Peter Zijlstra wrote:
> > 
> > >> The exact interaction of mmap() and truncate() I'm not exactly clear on.
> > > 
> > > Truncate will reduce the size of the mmaps on the file to
> > > match the new file size, so processes accessing beyond the
> > > end of file will get a segmentation fault (SIGSEGV).
> > 
> > I suspect Peter was talking about using truncate() to set the initial 
> > file size, effectively increasing rather than reducing it.
> 
> I was thinking of truncate() on an already mmap()'ed region, either
> increasing or decreasing the size so that part of the mmap becomes
> (in)valid.
> 
> I'm not sure how POSIX speaks of this.
> 
> I think Linux does the expected thing.

I believe our behaviour is correct for mmap/mumap/truncate and it
certainly used to be and was tested.

At the point you do anything involving mremap (which is non posix) our
behaviour becomes rather bizarre.

Alan

--
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>

  reply	other threads:[~2008-11-04 16:28 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 [this message]
2008-11-04 16:51           ` Eugene V. Lyubimkin
2008-11-05 16:42             ` Hugh Dickins
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=20081104162820.644b1487@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=cfriesen@nortel.com \
    --cc=hugh@veritas.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