public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: Kenny Simpson <theonetruekenny@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: mmap-related questions
Date: Tue, 1 Apr 2003 12:50:20 -0500	[thread overview]
Message-ID: <20030401125020.E25225@redhat.com> (raw)
In-Reply-To: <20030401032546.17891.qmail@web20002.mail.yahoo.com>; from theonetruekenny@yahoo.com on Mon, Mar 31, 2003 at 07:25:46PM -0800

On Mon, Mar 31, 2003 at 07:25:46PM -0800, Kenny Simpson wrote:
> --- Benjamin LaHaise <bcrl@redhat.com> wrote:
> > No.  You must use msync().
> 
> > Note that fsync() after
> > munmap() will flush the 
> > pages to disk under Linux.
> Sweet!  Paydirt!  Is this documented/guaranteed to
> continue to work for a while?
> Is this true for all non-mmap()ed dirty buffers for a
> given file?

It's only true for the pages the munmap() removes from the process' page 
tables: the act of unmapping them transfers the dirty bit from the page 
tables into the page cache where fsync() acts on them.

> Just to restate what you said:
> - if part of a file is mmap()ed, msync() MUST be used
> to sync it.
> - any non-mmap()ed portions are synched with fsync().

Pretty much.

> I'm assuming this is a per-process thing.  i.e. The
> above is true regardless of what other processes are
> doing (e.g. even if another process has the same file
> mmap()'d, I don't care).

Right.  Other processes are responsible for managing their own syncing of 
dirty bits to disk at the appropriate times.  The one case this breaks down 
on is when the mmap()'d file is on NFS -- the reordering there can result in 
writebacks from mmap()s occuring in unexpected ways.  But then, nobody trusts 
their data to NFS, right?  ;-)

		-ben
-- 
Junk email?  <a href="mailto:aart@kvack.org">aart@kvack.org</a>

  reply	other threads:[~2003-04-01 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-31 14:41 mmap-related questions Kenny Simpson
2003-03-31 17:55 ` Benjamin LaHaise
2003-04-01  3:25   ` Kenny Simpson
2003-04-01 17:50     ` Benjamin LaHaise [this message]
2003-04-02  3:18       ` Kenny Simpson
2003-04-02  9:30         ` Jakob Oestergaard
2003-04-02 15:10           ` Benjamin LaHaise
2003-04-02 23:43             ` Jakob Oestergaard

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=20030401125020.E25225@redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=theonetruekenny@yahoo.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