mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@bonn-fries.net>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Andreas Dilger <adilger@turbolabs.com>,
	Andrea Arcangeli <andrea@suse.de>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-2.4.10-pre5
Date: Tue, 11 Sep 2001 18:52:57 +0200	[thread overview]
Message-ID: <20010911164544Z16026-1365+38@humbolt.nl.linux.org> (raw)
In-Reply-To: <Pine.LNX.4.33.0109110821520.8078-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.33.0109110821520.8078-100000@penguin.transmeta.com>

On September 11, 2001 05:39 pm, Linus Torvalds wrote:
> On Tue, 11 Sep 2001, Daniel Phillips wrote:
> > > In short, you'll end up doing a memcpy() pretty much every single time you
> > > hit.
> >
> > And *only* when we hit.  Even if we don't optimize away the memcpy, it's a
> > win, so long as we get enough hits to make up for the cost of any wasted
> > readaheads.  Any time physical readahead correctly hits a block of metadata
> > then chances are good we've eliminated a synchronous stall.
> 
> Ehh..
> 
> Your argument seems to be "it won't cost us anything if we don't hit".
> 
> But hey, if we don't hit, then it _will_ cost us - that implies that the
> read-ahead was _completely_ wasted. That's the worst case, not the "good"
> case. You've just wasted CPU cycles in setting up the bogus IO, and disk
> and bus cycles in executing it.

My fault for being imprecise.  By "hit" I meant "hit readahead data in the 
buffer cache".  Hits on data already in the page cache will work exactly as 
they do now, and page cache data that is originally accessed through the page 
cache (i.e., whenever we know its mapping) will not take a side trip through 
the buffer cache.

> > Aha.  So we are going to do the buffer cache hash probe anyway, the thing I
> > call the the reverse lookup.  Now I'm just suggesting we drop the other shoe
> > and chain all the page cache blocks to the buffer hash.  The only extra cost
> > will be the buffer hash insert and delete, and in return we get complete
> > coherency.
> 
> "complete"? No. The coherency is very much one-way: we'd better not have
> anything that actually dirties the buffer cache, because that dirtying
> will _not_ be seen by a virtual cache.

Then I haven't communicated what I had in mind to do.  Dirtying data through 
the buffer cache would be ok.  There are two cases: 1) the block is in the 
page cache, but we get to it through the buffer hash chain instead of the 
page hash chain.  Fine, we can dirty it.  2) the block is not in the page 
cache.  We can still dirty it, because if the page cache tries to add that 
block it will first go look for it in the "buffer cache" (which is really 
just a way of saying "not in the page cache") and move it into the page
cache.

> [...]
> Your argument is fundamentally flawed: remember that you cannot actually
> _use_ the data you read ahead before you actually have the linear mapping.
> And you have to get the meta-data information before you can _create_ the
> linear mapping.

You are seeing an inconsistency I'm not seeing.

> Doing physical read-ahead does not mean you can avoid reading meta-data,
> and if you claim that as a "win", you're just lying to yourself.
> 
> Doing physical read-ahead only means that you can read-ahead _before_
> reading meta-data: it does not remove the need for meta-data, it only
> potentially removes a ordering dependency.

Right.

> But it potentially removes that ordering dependency through speculation
> (only if the speculation ends up being correct, of course), and
> speculation has a cost. This is nothing new - people have been doing
> things like this at other levels for a long time (doing things like data
> speculation inside CPU's, for example).
> 
> Basically, you do not decrease IO - you only try to potentially make it
> more parallel. Which can be a win.
> 
> But it can be a big loss too. Speculation always ends up depending ont he
> fact that you have more "throughput" than you actually take advantage of.
> By implication, you can also clearly see that speculation is bound to be
> provably _bad_ in any case where you can already saturate your resources.

Absolutely, so such a facility must shut itself down when there are other 
demands for the bandwidth.

> [...]
> Marginally better is not good enough if other loads are marginally worse.

Of course I did not mean that.  I meant marginally better on average.

> And I will bet that you _will_ see marginally worse numbers. Which is why
> I think you want "clearly better" just to offset the marginally worse
> numbers.

OK, I'll buy that.
 
> > > Basically, the things where physical read-ahead might win:
> > >  - it can be done without metadata (< 1%)
> >
> > See above.  It's not the actual size of the metadata that matters, it's
> > the way it serializes access to the data blocks.
> 
> See above. It always will. There is NO WAY you can actually return the
> file data to the user before having read the metadata. QED.

Fine, but you may already have read the *data* by the time you read the 
metadata, and so don't have to wait for it, it's already in cache.  That's
where the win is.

> You ONLY remove ordering constraints, nothing more.

Agreed.  But that's a big deal.

> [...]
> With 2MB of disk cache (which is what all the IDE disks _I_ have access to
> have), the disk will have more of a read-ahead buffer than you'd
> reasonably do in software. How much did you imagine you'd read ahead
> physically? Megabytes? I don't think so..

Yes, I was thinking megabytes in order to get anything close to the 5X 
improvement that appears to be possible.  But first I was planning to start 
more modestly, just pick up a few preemptive data reads here and there that 
the logical readahead mechanism would miss, in addition to servicing the 
logical readahead just as we do now.

To do the more ambitious multi-megabyte readahead, I had in mind something
that would combine information from some highlevel sources - directory 
operations, generic_read, etc - with information picked up at the
physical level, massaging it all into a kind of display from which we'd
be able to determine easily that we have a trend going on like "reading
the whole damm directory".  Once we know that's what we're doing it's not 
hard to see what to do about it.

Just to do a reality check on that: if somebody reads the first 1/10 of
the files in a directory tree in getdents order, it's a pretty safe bet
they're going to read the other 9/10ths, right?

--
Daniel

  reply	other threads:[~2001-09-11 16:45 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-08  4:18 linux-2.4.10-pre5 Linus Torvalds
2001-09-08  6:32 ` linux-2.4.10-pre5: drivers/net/wan compile fixes Eyal Lebedinsky
2001-09-08  6:36 ` 2.4.9-ac10 (not 2.4.10-pre5!) wan fixes Eyal Lebedinsky
2001-09-08  8:32 ` 2.4.10-pre5 compile error George Bonser
2001-09-08 17:19 ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-08 17:30   ` linux-2.4.10-pre5 Linus Torvalds
2001-09-08 17:57     ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-08 18:01       ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  1:09         ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09  1:20           ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  1:38             ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09  1:53               ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  2:22                 ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09  2:31                   ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  3:30                     ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09  3:58                       ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  4:16                         ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09  4:28                           ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09 12:09                             ` linux-2.4.10-pre5 Rik van Riel
2001-09-09 14:53                               ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09 18:17                               ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09 20:18                                 ` linux-2.4.10-pre5 H. Peter Anvin
2001-09-10  0:39                                   ` linux-2.4.10-pre5 Simon Kirby
2001-09-10  8:30                                     ` linux-2.4.10-pre5 Kai Henningsen
2001-09-11  5:29                                       ` linux-2.4.10-pre5 Peter Samuelson
2001-09-11 11:29                                         ` linux-2.4.10-pre5 Kai Henningsen
2001-09-10 21:22                                   ` linux-2.4.10-pre5 Stephen C. Tweedie
2001-09-09 14:47                             ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09 16:24                               ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09 17:29                                 ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-09 23:56                             ` linux-2.4.10-pre5 Daniel Phillips
2001-09-09  4:29                         ` linux-2.4.10-pre5 Andreas Dilger
2001-09-09  4:54                           ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09  6:17                             ` linux-2.4.10-pre5 Andreas Dilger
2001-09-09 17:31                               ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09 19:19                                 ` linux-2.4.10-pre5 Daniel Phillips
2001-09-09 23:24                                   ` linux-2.4.10-pre5 Linus Torvalds
2001-09-09 23:54                                     ` linux-2.4.10-pre5 Alan Cox
2001-09-10  0:04                                       ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10  0:23                                       ` linux-2.4.10-pre5 Linus Torvalds
2001-09-10  0:23                                     ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10  0:38                                       ` linux-2.4.10-pre5 Linus Torvalds
2001-09-10  1:04                                         ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-10  1:45                                         ` linux-2.4.10-pre5 Chris Mason
2001-09-10  1:55                                           ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-10  2:15                                             ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10  2:20                                               ` linux-2.4.10-pre5 Chris Mason
2001-09-10  2:40                                                 ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10  3:02                                                 ` linux-2.4.10-pre5 Chris Mason
2001-09-10  3:36                                                   ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10 19:06                                                   ` linux-2.4.10-pre5 Chris Mason
2001-09-10  2:22                                               ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10  2:02                                           ` linux-2.4.10-pre5 Chris Mason
2001-09-10  2:06                                             ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-10  2:03                                           ` linux-2.4.10-pre5 Linus Torvalds
2001-09-10  2:41                                             ` linux-2.4.10-pre5 Chris Mason
2001-09-10 21:18                                     ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10 21:23                                       ` linux-2.4.10-pre5 Alex Bligh - linux-kernel
2001-09-10 21:54                                         ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10 22:39                                           ` linux-2.4.10-pre5 Alex Bligh - linux-kernel
2001-09-10 23:13                                             ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10 23:25                                               ` linux-2.4.10-pre5 Alex Bligh - linux-kernel
2001-09-10 22:15                                       ` linux-2.4.10-pre5 Linus Torvalds
2001-09-10 22:26                                         ` linux-2.4.10-pre5 Linus Torvalds
2001-09-10 22:39                                         ` linux-2.4.10-pre5 Rik van Riel
2001-09-10 23:14                                           ` linux-2.4.10-pre5 Daniel Phillips
2001-09-10 23:16                                             ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11  0:53                                               ` linux-2.4.10-pre5 Rik van Riel
2001-09-11  6:39                                                 ` linux-2.4.10-pre5 Hua Zhong
2001-09-11 15:12                                                 ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11 15:44                                                   ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11 15:48                                                     ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11 16:05                                                       ` linux-2.4.10-pre5 Alex Bligh - linux-kernel
2001-09-11 16:07                                                       ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11 16:07                                                         ` linux-2.4.10-pre5 Alex Bligh - linux-kernel
2001-09-11 16:13                                                           ` linux-2.4.10-pre5 Martin Dalecki
2001-09-11 17:17                                                       ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11 10:02                                           ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11 20:07                                             ` linux-2.4.10-pre5 Rik van Riel
2001-09-10 23:20                                         ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11  0:20                                           ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11  1:16                                             ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11  2:27                                               ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11  7:45                                                 ` linux-2.4.10-pre5 Helge Hafting
2001-09-11 10:27                                                 ` linux-2.4.10-pre5 Daniel Phillips
2001-09-11 15:39                                                   ` linux-2.4.10-pre5 Linus Torvalds
2001-09-11 16:52                                                     ` Daniel Phillips [this message]
2001-09-09 19:51                               ` linux-2.4.10-pre5 Daniel Phillips
2001-09-09  9:05                           ` linux-2.4.10-pre5 Christoph Hellwig
2001-09-09 13:14                           ` linux-2.4.10-pre5 Anton Altaparmakov
2001-09-09 14:31                             ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-08 21:15     ` linux-2.4.10-pre5 Andreas Dilger
2001-09-09  0:59       ` linux-2.4.10-pre5 Andrea Arcangeli
2001-09-08 22:01 ` linux-2.4.10-pre5 Thiago Vinhas de Moraes

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=20010911164544Z16026-1365+38@humbolt.nl.linux.org \
    --to=phillips@bonn-fries.net \
    --cc=adilger@turbolabs.com \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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

all inboxes | Powered by JetHome®