From: Andrew Morton <akpm@osdl.org>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux@horizon.com, linux-kernel@vger.kernel.org, sct@redhat.com,
torvalds@osdl.org
Subject: Re: msync() behaviour broken for MS_ASYNC, revert patch?
Date: Thu, 9 Feb 2006 22:46:56 -0800 [thread overview]
Message-ID: <20060209224656.7533ce2b.akpm@osdl.org> (raw)
In-Reply-To: <43EC3326.4080706@yahoo.com.au>
Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
> Andrew Morton wrote:
> > Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
> >>and had no need for a MS_SYNC anywhere in the meantime.
> >>If you did have the need for MS_SYNC, then kicking off the IO
> >>ASAP is going to be more efficient.
> >
> >
> > Of course these sorts of applications don't know what they'll be doing in
> > the future. Often the location of the next update is driven by something
> > which came across the network.
> >
>
> If there is no actual need for the application to start a write (eg
> for data integrity) then why would it ever do that?
To get the data sent to disk in a reasonable amount of time - don't leave it
floating about in memory for hours or days.
> >
> > There's no need to do that. Look:
> >
> > msync(MS_ASYNC): propagate pte dirty flags into pagecache
> >
> > LINUX_FADV_ASYNC_WRITE: start writeback on all pages in region which are
> > dirty and which aren't presently under writeback.
> >
> > LINUX_FADV_WRITE_WAIT: wait on writeback of all pages in range.
> >
> > I think that covers all conceivable scenarios. One thing per operation,
> > leave the decisions and tuning up to the application. And it gives us two
> > operations which are also useful in association with regular write().
> >
>
> Oh yeah it is easy if you want to define some more APIs and do
> it in a Linux specific way.
>
> But the main function of msync(MS_ASYNC) AFAIK is to *start* IO.
> Why do we care so much if some application goes stupid with it?
Because delaying the writeback to permit combining is a good optimisation.
The alternative of not starting new writeout of a dirty page if that page
happens to be under writeout at the time is neither one nor the other.
With that proposal, if the application really wants IO started right now,
then it's going to have to use msync(MS_SYNC).
> Why not introduce a linux specific MS_flag to propogate pte dirty
> bits?
That's what MS_ASYNC already does. We're agreed that something needs to
change and we're just discussing what that is. I'm proposing something
which is complete and flexible.
Another point here is that msync(MS_SYNC) starts writeout of _all_ dirty
pages in the file (as MS_ASYNC used to do) and it waits upon writeback of
the whole file. That's quite inefficient for an app which has lots of
threads writing to and msync()ing the same MAP_SHARED file.
We could easily enough convert msync() to only operate on the affected
region of the (non-linearly-mapped) file. But I don't think we can do that
now, because people might be relying upon the side-effects.
The fadvise() extensions allow us to fix this. And we've needed them for
some time for regular write()s anyway.
next prev parent reply other threads:[~2006-02-10 6:47 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-09 7:18 msync() behaviour broken for MS_ASYNC, revert patch? linux
2006-02-09 8:18 ` Andrew Morton
2006-02-09 8:35 ` Nick Piggin
2006-02-09 8:42 ` Andrew Morton
2006-02-09 12:38 ` Nick Piggin
2006-02-09 12:39 ` Nick Piggin
2006-02-09 17:48 ` Andrew Morton
2006-02-10 3:36 ` Nick Piggin
2006-02-10 3:50 ` Andrew Morton
2006-02-10 3:57 ` Nick Piggin
2006-02-10 4:13 ` Andrew Morton
2006-02-10 4:30 ` Nick Piggin
2006-02-10 4:43 ` Andrew Morton
2006-02-10 4:52 ` Nick Piggin
2006-02-10 5:13 ` Andrew Morton
2006-02-10 5:29 ` Nick Piggin
2006-02-10 5:50 ` Andrew Morton
2006-02-10 6:03 ` Nick Piggin
2006-02-10 6:13 ` Andrew Morton
2006-02-10 6:31 ` Nick Piggin
2006-02-10 6:46 ` Andrew Morton [this message]
2006-02-10 6:57 ` Nick Piggin
2006-02-10 7:14 ` Andrew Morton
2006-02-10 12:41 ` Nick Piggin
2006-02-10 16:19 ` Linus Torvalds
2006-02-10 17:00 ` Nick Piggin
2006-02-10 17:12 ` Linus Torvalds
2006-02-10 17:35 ` Linus Torvalds
2006-02-10 17:59 ` Nick Piggin
2006-02-10 18:55 ` Linus Torvalds
2006-02-10 19:29 ` Nick Piggin
2006-02-10 19:44 ` Linus Torvalds
2006-02-10 19:52 ` Nick Piggin
2006-02-10 20:03 ` Linus Torvalds
2006-02-11 5:49 ` Nick Piggin
2006-02-10 16:05 ` Linus Torvalds
2006-02-10 16:37 ` Nick Piggin
2006-02-10 17:03 ` Linus Torvalds
2006-02-10 17:37 ` Nick Piggin
2006-02-10 18:01 ` Linus Torvalds
2006-02-10 18:38 ` Nick Piggin
2006-02-10 19:05 ` Linus Torvalds
2006-02-10 19:34 ` Oliver Neukum
2006-02-10 19:59 ` Linus Torvalds
2006-02-10 20:11 ` Andrew Morton
2006-02-10 21:15 ` Linus Torvalds
2006-02-10 21:28 ` Andrew Morton
2006-02-10 20:03 ` Nick Piggin
2006-02-10 21:10 ` Linus Torvalds
2006-02-10 21:55 ` Trond Myklebust
2006-02-10 22:46 ` Linus Torvalds
2006-02-10 23:02 ` Trond Myklebust
2006-02-10 23:15 ` Linus Torvalds
2006-02-11 19:07 ` Trond Myklebust
2006-02-10 17:29 ` linux
2006-02-10 17:42 ` Linus Torvalds
2006-02-10 18:57 ` Nick Piggin
2006-02-10 8:00 ` linux
2006-02-10 13:18 ` Nick Piggin
2006-02-10 7:15 ` linux
2006-02-10 7:28 ` Andrew Morton
2006-02-09 11:18 ` linux
-- strict thread matches above, loose matches on Subject: below --
2004-03-31 22:16 Stephen C. Tweedie
2004-03-31 22:37 ` Linus Torvalds
2004-03-31 23:41 ` Stephen C. Tweedie
2004-04-01 0:08 ` Linus Torvalds
2004-04-01 0:30 ` Andrew Morton
2004-04-01 15:40 ` Stephen C. Tweedie
2004-04-01 16:02 ` Linus Torvalds
2004-04-01 16:33 ` Stephen C. Tweedie
2004-04-01 16:19 ` Jamie Lokier
2004-04-01 16:57 ` Stephen C. Tweedie
2004-04-01 18:51 ` Andrew Morton
2004-03-31 22:53 ` Andrew Morton
2004-03-31 23:20 ` Stephen C. Tweedie
2004-04-16 22:35 ` Jamie Lokier
2004-04-19 21:54 ` Stephen C. Tweedie
2004-04-21 2:10 ` Jamie Lokier
2004-04-21 9:52 ` Stephen C. Tweedie
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=20060209224656.7533ce2b.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=nickpiggin@yahoo.com.au \
--cc=sct@redhat.com \
--cc=torvalds@osdl.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