public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: msync() more expensive than fsync()?
Date: 10 Apr 2003 12:36:16 -0700	[thread overview]
Message-ID: <b74h3g$55l$1@cesium.transmeta.com> (raw)
In-Reply-To: 3E92FAE6.8000300@nortelnetworks.com

Followup to:  <3E92FAE6.8000300@nortelnetworks.com>
By author:    Chris Friesen <cfriesen@nortelnetworks.com>
In newsgroup: linux.dev.kernel
> 
> Without any explicit flushing it takes 8 usec to log a message.
> 
> If I msync() only the pages that were touched in writing (usually 3 pages) it 
> takes 39 usecs to log a message.
> 
> If I fsync() the entire file (200KB) it takes 12 usec to log a message.
> 
> Why the additional cost for msync()?  I would have thought it would be faster 
> since it is explicitely for mmapped memory areas.  As a side note, the 
> difference is even more extreme if a file is used on a disk-backed filesystem.
> 

Because fsync() does less work.  In particular, fsync() doesn't do the
work you want: unlike msync() it doesn't guarantee that memory maps
are consistent with the filesystem.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64

      parent reply	other threads:[~2003-04-10 19:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-08 16:37 msync() more expensive than fsync()? Chris Friesen
2003-04-09 17:48 ` Rik van Riel
2003-04-10 19:36 ` H. Peter Anvin [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='b74h3g$55l$1@cesium.transmeta.com' \
    --to=hpa@zytor.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