From: Jamie Lokier <jamie@shareable.org>
To: Gianni Tedesco <giannit@securewave.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: mmap(MAP_PRIVATE) question
Date: Wed, 3 Sep 2003 11:28:05 +0100 [thread overview]
Message-ID: <20030903102804.GA21455@mail.jlokier.co.uk> (raw)
In-Reply-To: <1062581651.489.5.camel@lemsip>
Gianni Tedesco wrote:
> Hi all,
>
> >From the mmap(2) manpage it says:
>
> 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.
>
> What is linux behaivour in this area? I am guessing if the page is
> modified between the call to mmap() and fault-in then the modified copy
> is seen by the application? But what about modifications after the page
> is already in page-cache?
The page cache page is mapped into the application just like a shared
mapping, until the application writes to the mapped region and
triggers the copy-on-write fault.
This means that if you write() to the page prior to the copy-on-write
fault, you may see the changes in application memory straight away.
If some other process writes to the page through a writable mapping,
you may see the changes.
On the other hand you may not. On some of the architectures which
Linux supports, the CPU's cache is not sufficiently coherent to
guarantee that what is written with write(), or by another process,
will be seen in this application's memory. Indeed, you might see a
mixture of some of the written data and some of the data before it was
written, with no particular guarantee of which bits of data or in what
order.
-- Jamie
next prev parent reply other threads:[~2003-09-03 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-03 9:34 Gianni Tedesco
2003-09-03 10:28 ` Jamie Lokier [this message]
2003-09-03 13:37 ` Gianni Tedesco
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=20030903102804.GA21455@mail.jlokier.co.uk \
--to=jamie@shareable.org \
--cc=giannit@securewave.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®