linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: "Eric W. Biederman" <ebiederm+eric@ccr.net>
Cc: "Stephen C. Tweedie" <sct@redhat.com>,
	Jamie Lokier <lk@tantalophile.demon.co.uk>,
	Richard Guenther <richard.guenther@student.uni-tuebingen.de>,
	Linux Kernel List <linux-kernel@vger.rutgers.edu>,
	glame-devel@lists.sourceforge.net, Linux-MM <linux-mm@kvack.org>
Subject: Re: mmap/munmap semantics
Date: Thu, 24 Feb 2000 13:49:18 +0000 (GMT)	[thread overview]
Message-ID: <14517.14046.474143.77633@dukat.scot.redhat.com> (raw)
In-Reply-To: <m166velnty.fsf@flinx.hidden>

Hi,

On 24 Feb 2000 07:41:45 -0600, ebiederm+eric@ccr.net (Eric W. Biederman)
said:

>> The system will free any whole pages in the specified
>> region.  All modifications will be lost and any swapped
>> out pages will be discarded.  Subsequent access to the
>> region will result in a zero-fill-on-demand fault as
>> though it is being accessed for the first time.
>> Reserved swap space is not affected by this call.

> Which is fine but if it works this way on shared memory it is broken,
> at least unless all mappings set (MADV_DONTNEED) and you can prove there
> was no file-io.  Otherwise you could loose legitimate file writes.

Not necessarily, if this behaviour is defined.  It is no more broken
than the fact that write() can overwrite another process's data, or
truncate() can invalidate another process's mapping.  This is an
explicitly destructive system call and the user must have write access
to the file.

The discarding of modifications is obviously correct if the mapping is
MAP_PRIVATE, but I'd be interested in seeing what other Unixen actually
do on MAP_SHARED maps.  Similarly,

   msync(MS_INVALIDATE)

is expected to discard modifications by some applications (and I've
personally had requests for this funcationality from vendors whose
applications use it on shared memory segments).  Its definition in DU
includes:

  After a successful call to the msync() function with the flags parameter
  set to MS_INVALIDATE, all previous modifications to the file using the
  write() function are visible to the mapped region.  Previous direct
  modifications to the mapped region might be lost.

Again it isn't explicit whether this applies only to MAP_PRIVATE or to
MAP_SHARED too.

--Stephen
--
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.eu.org/Linux-MM/

      reply	other threads:[~2000-02-24 13:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-22 17:46 Richard Guenther
2000-02-22 18:36 ` James Antill
2000-02-22 18:41 ` Benjamin C.R. LaHaise
2000-02-23 10:57   ` Richard Guenther
2000-02-23 15:58     ` Benjamin C.R. LaHaise
2000-02-24 10:06       ` Richard Guenther
2000-02-22 21:48 ` Richard Gooch
2000-02-23  3:49 ` Eric W. Biederman
2000-02-23 11:14   ` Richard Guenther
2000-02-23 15:44   ` Jamie Lokier
2000-02-23 18:48 ` Stephen C. Tweedie
2000-02-24  2:35   ` Jamie Lokier
2000-02-24 12:13     ` Stephen C. Tweedie
2000-02-24 12:24       ` Richard Guenther
2000-02-24 13:51         ` Stephen C. Tweedie
2000-02-24 15:01         ` kernel
2000-02-24 15:03           ` Richard Guenther
2000-02-24 15:15             ` Jamie Lokier
2000-02-24 13:06       ` lars brinkhoff
2000-02-24 14:42         ` Jamie Lokier
2000-02-24 13:41       ` Eric W. Biederman
2000-02-24 13:49         ` Stephen C. Tweedie [this message]

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=14517.14046.474143.77633@dukat.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=ebiederm+eric@ccr.net \
    --cc=glame-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=lk@tantalophile.demon.co.uk \
    --cc=richard.guenther@student.uni-tuebingen.de \
    /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