From: Daniel Phillips <phillips@bonn-fries.net>
To: Richard Gooch <rgooch@ras.ucalgary.ca>,
Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Getting FS access events
Date: Tue, 15 May 2001 02:42:16 +0200 [thread overview]
Message-ID: <01051502421603.24410@starship> (raw)
In-Reply-To: <200105140515.f4E5FwP10245@vindaloo.ras.ucalgary.ca> <Pine.LNX.4.31.0105141301120.22874-100000@penguin.transmeta.com> <200105142319.f4ENJpf19203@vindaloo.ras.ucalgary.ca>
In-Reply-To: <200105142319.f4ENJpf19203@vindaloo.ras.ucalgary.ca>
On Tuesday 15 May 2001 01:19, Richard Gooch wrote:
> Linus Torvalds writes:
> > On Sun, 13 May 2001, Richard Gooch wrote:
> > > So, why can't the page cache check if a block is in the buffer
> > > cache?
> >
> > Because it would make the damn thing slower.
> >
> > The whole point of the page cache is to be FAST FAST FAST. The
> > reason we _have_ a page cache is that the buffer cache is slow and
> > inefficient, and it will always remain so.
>
> Is there some fundamental reason why a buffer cache can't ever be
> fast?
Just looking at getblk, it takes one more lock than read_cache_page
(these are noops in UP) and otherwise has very nearly the same sequence
of operations. This can't be the slowness he's talking about.
I know of three ways the buffer cache earned its reputation for
slowness: 1) There used to be a copy from the buffer cache to page
cache on every write, to keep the two in sync 2) Having the same data
in both the buffer and page cache created extra memory pressure 3) To
get at file data through the buffer cache you have to traverse all the
index blocks every time, whereas with the logically-indexed page cache
you go straight to the page data, if it's there, and in theory[1], only
up as many levels of index as you have to.
Once you have looked into the page cache and know the page isn't there
you know you are going to have to read it. At this point, the overhead
of hashing into, say, the buffer cache to see if the block is there is
trivial. Just one saved read by doing that will be worth hundreds of
hash lookups. But why use the buffer cache? The page cache will work
perfectly well for this.
There's a big saving in using a block cache for readahead instead of
file-oriented readahead: if we guess wrong and don't actually need the
readahead blocks then we paid less to get them - we didn't call into
the filesystem to map each one. Additionally, a block cache can do
things that file readahead can't, as you showed in your example:
> - inode at block N
> - indirect block at N+k+j
> - data block at N+k
Another example is where you have blocks from two different files mixed
together, and you read both of those files.
Note that your scsi disk controller is keeping a cache for you over on
its side of the bus. This erodes the benefit of the block cache
somewhat, but the same argument applies to file readahead. For all
people who don't have scsi the block cache would be a big win.
[1] This remains theoretical until we get the indirect blocks into the
page cache.
--
Daniel
next prev parent reply other threads:[~2001-05-15 1:35 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200105140117.f4E1HqN07362@vindaloo.ras.ucalgary.ca>
2001-05-14 1:32 ` Getting FS access events Linus Torvalds
2001-05-14 1:45 ` Larry McVoy
2001-05-14 2:39 ` Richard Gooch
2001-05-14 3:09 ` Rik van Riel
2001-05-14 4:27 ` Richard Gooch
2001-05-15 4:37 ` Chris Wedgwood
2001-05-23 11:37 ` Stephen C. Tweedie
2001-05-14 2:24 ` Richard Gooch
2001-05-14 4:46 ` Linus Torvalds
2001-05-14 5:15 ` Richard Gooch
2001-05-14 13:04 ` Daniel Phillips
2001-05-14 18:00 ` Andreas Dilger
2001-05-14 20:16 ` Linus Torvalds
2001-05-14 23:19 ` Richard Gooch
2001-05-15 0:42 ` Daniel Phillips [this message]
2001-05-15 4:00 ` Linus Torvalds
2001-05-15 4:35 ` Larry McVoy
2001-05-15 4:57 ` David S. Miller
2001-05-15 5:12 ` Alexander Viro
2001-05-15 9:10 ` Alan Cox
2001-05-15 9:48 ` Lars Brinkhoff
2001-05-15 9:54 ` Alexander Viro
2001-05-15 20:17 ` Kai Henningsen
2001-05-15 20:58 ` Alexander Viro
2001-05-15 21:08 ` Alexander Viro
2001-05-15 4:59 ` Alexander Viro
2001-05-15 17:01 ` Pavel Machek
2001-05-15 4:43 ` Linus Torvalds
2001-05-15 5:04 ` Alexander Viro
2001-05-15 6:20 ` Richard Gooch
2001-05-15 6:28 ` Linus Torvalds
2001-05-15 6:49 ` Richard Gooch
2001-05-15 6:57 ` Alexander Viro
2001-05-15 10:33 ` Daniel Phillips
2001-05-15 10:44 ` Alexander Viro
2001-05-15 14:42 ` Daniel Phillips
2001-05-15 7:13 ` Linus Torvalds
2001-05-15 7:56 ` Chris Wedgwood
2001-05-15 8:06 ` Linus Torvalds
2001-05-15 8:33 ` Alexander Viro
2001-05-15 10:27 ` David Woodhouse
2001-05-15 16:00 ` Chris Mason
2001-05-15 19:26 ` H. Peter Anvin
2001-05-15 20:03 ` Alexander Viro
2001-05-15 20:07 ` H. Peter Anvin
2001-05-15 20:15 ` Alexander Viro
2001-05-15 20:17 ` H. Peter Anvin
2001-05-15 20:22 ` Alexander Viro
2001-05-15 20:26 ` H. Peter Anvin
2001-05-15 20:31 ` Alexander Viro
2001-05-15 21:12 ` Linus Torvalds
2001-05-15 21:22 ` H. Peter Anvin
2001-05-15 21:02 ` Linus Torvalds
2001-05-15 21:53 ` Jan Harkes
2001-05-19 5:26 ` Chris Wedgwood
2001-05-15 10:04 ` Anton Altaparmakov
2001-05-15 19:28 ` H. Peter Anvin
2001-05-15 22:31 ` Albert D. Cahalan
2001-05-15 22:35 ` H. Peter Anvin
2001-05-16 1:17 ` Anton Altaparmakov
2001-05-16 1:30 ` H. Peter Anvin
2001-05-16 8:34 ` Anton Altaparmakov
2001-05-16 16:27 ` H. Peter Anvin
2001-05-15 16:26 ` Pavel Machek
2001-05-15 18:02 ` Craig Milo Rogers
2001-05-15 16:17 ` Pavel Machek
2001-05-19 19:39 ` Linus Torvalds
2001-05-19 19:44 ` Pavel Machek
2001-05-19 19:47 ` Linus Torvalds
2001-05-23 11:29 ` Stephen C. Tweedie
2001-05-20 4:30 ` Chris Wedgwood
2001-05-20 19:47 ` Alan Cox
2001-05-18 7:55 ` Rogier Wolff
2001-05-23 11:36 ` Stephen C. Tweedie
2001-05-15 6:13 ` Richard Gooch
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=01051502421603.24410@starship \
--to=phillips@bonn-fries.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rgooch@ras.ucalgary.ca \
--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