public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	linux@horizon.com, linux-kernel@vger.kernel.org, sct@redhat.com
Subject: Re: msync() behaviour broken for MS_ASYNC, revert patch?
Date: Sat, 11 Feb 2006 06:52:31 +1100	[thread overview]
Message-ID: <43ECEEFF.7050905@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0602101138480.19172@g5.osdl.org>

Linus Torvalds wrote:
> 
> On Sat, 11 Feb 2006, Nick Piggin wrote:
> 
>>>Your pattern would actually be
>>>
>>>	.. dirty offset 100-200 ..
>>>	fadvice(fd, 100, 200, FADV_WRITE_START);
>>>
>>>	.. dirty offset 200-300 ..
>>>	fadvice(fd, 200, 300, FADV_WRITE_START);
>>>
>>>	.. dirty offset 300-400 ..
>>>	fadvice(fd, 300, 400, FADV_WRITE_START);
>>>
>>>	.. dirty offset 400-415 .. (for the next transaction)
>>>
>>
>>- IOW if the app or OS crashed here it would be possible to see 400-415 on
>>the disk and none of the previous transactions (assuming we don't know
>>the page size).
> 
> 
> If the app/OS crashed here, nothing would matter. We haven't committed 
> anything at all yet. We've just started the IO. What is at 400-415 simply 
> doesn't matter, because nobody would have any reason to look at it.
> 
> (Besides, it's not at all clear that 400-415 would or would not be on 
> disk. It depends on entirely on timing and buffering of the IO system at 
> that point - the fact that its dirty in memory doesn't mean that it ever 
> made it into the IO buffer that was started).
> 
> 
>>>	fadvice(fd, 100, 400, FADV_JUST_WAIT); (for the previous one)
> 
> 
> This is the one that waits for it to finish, so _now_ we can update the 
> pointers (elsewhere) to that log (and if the app/OS crashes before that, 
> nobody will even know about it).
> 
> See?
> 

Well in that case in your argument your FADV_WRITE_START is of
the "waits for writeout then starts writeout if dirty" type.

In which case you've just made 3 consecutive  write+wait cycles
to the same page, so it is hardly an optimal IO pattern.

> 
>>I'm not convinced. You above example was bogus.
> 
> 
> No, your understanding was incomplete. I'm talking about just parts of a 
> much bigger transaction. 
> 
> A single write on its own is almost never a transaction unless your system 
> is _purely_ log-based (which it could be, of course. Not in my example).
> 

You were saying that your above sequence would be more efficient
if implemented with "always start IO, and just wait for IO", because
"write and wait" would do 2 write+wait cycles.

However "always start IO, and just wait for IO" does 3 write+wait cycles.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2006-02-10 19:52 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
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 [this message]
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=43ECEEFF.7050905@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --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