From: Scott Kaplan <sfkaplan@cs.amherst.edu>
To: Rik van Riel <riel@conectiva.com.br>
Cc: Andrew Morton <akpm@zip.com.au>, Christoph Hellwig <hch@lst.de>,
torvalds@transmeta.com, linux-mm@kvack.org
Subject: Re: [RFC] start_aggressive_readahead
Date: Sun, 28 Jul 2002 22:12:08 -0400 [thread overview]
Message-ID: <95C024B4-A298-11D6-A4C0-000393829FA4@cs.amherst.edu> (raw)
In-Reply-To: <Pine.LNX.4.44L.0207282117040.3086-100000@imladris.surriel.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday, July 28, 2002, at 08:19 PM, Rik van Riel wrote:
> I'm not sure about that. If we do linear IO we most likely
> want to evict the pages we've already used as opposed to the
> pages we're about to use.
The situation is more subtle than that. I agree that in a linear I/O case,
the read-ahead pages are extremely likely to be used very soon. However,
that does *not* imply that they should be promoted to the active list --
in fact, quite the opposite when considering the read-ahead situation.
Consider exactly the case you have raised -- strict, linear referencing of
blocks, such as a sequential file read. When block `i' is referenced, it
is an excellent prediction that block `i+1' will be referenced soon. If
block `i+1' is not referenced soon, then the prediction was incorrect,
*and there's little reason to keep the block around any longer*. In other
words, the better the prediction, the closer to the end of the LRU
ordering the blocks can be placed. The ones that *are* used soon will be
referenced and promoted to the front of the LRU ordering before they are
evicted, exactly because the soonness of use is so strong. The read-ahead
blocks that are not used soon are evicted before long. In other words,
the shorter a time you think you need to keep a block, the closer to the
end of the list it should go. If your guess is wrong, you've displaced
fewer other blocks. If your prediction is a good one, such as with linear
file reading, you will not need to cache a block as a read-ahead block for
long before it is actually used.
It is when you predict that a read-ahead will not pay off for some time --
that the read-ahead blocks will not be used so soon -- that such blocks
need to be placed closer to the front of the LRU ordering (that is, in the
active list). That way, they will be cached much longer so that they will
still be resident when they finally are used. Of course, such caching
displaces more of the other pages, possibly causing faults on those. It
is when your read-ahead prediction indicates a weak soonness of use that
you must compare the benefits of caching those pages against the cost of
displacing other pages. Only if few pages near the end of the LRU
ordering -- non-read-ahead pages -- are being referenced might it be worth
caching read-ahead pages for so long.
So, in the case of linear I/O, placing the read-ahead pages at the front
of the inactive list is likely to provide more than enough time for those
pages to be used and promoted to the active list. By placing them in the
inactive list, you reduce the damage done when read-ahead pages are *not*
used soon.
Scott
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see http://www.gnupg.org
iD8DBQE9RKR78eFdWQtoOmgRAr1EAJ9RSY10utFCEvIftv9qEMNZzzczswCfTlZv
63z5vAMl38r+jtGQRImUkoY=
=X6S4
-----END PGP SIGNATURE-----
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
next prev parent reply other threads:[~2002-07-29 2:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-25 16:10 Christoph Hellwig
2002-07-25 16:44 ` Rik van Riel
2002-07-25 19:40 ` Andrew Morton
2002-07-26 16:50 ` Scott Kaplan
2002-07-26 19:38 ` Andrew Morton
2002-07-28 23:32 ` Scott Kaplan
2002-07-29 0:19 ` Rik van Riel
2002-07-29 2:12 ` Scott Kaplan [this message]
2002-07-29 3:05 ` Rik van Riel
2002-07-29 15:24 ` Scott Kaplan
2002-07-29 7:34 ` Andrew Morton
2002-07-29 7:37 ` Vladimir Dergachev
2002-07-29 7:53 ` Andrew Morton
2002-07-29 8:04 ` Rik van Riel
2002-07-30 16:11 ` Scott Kaplan
2002-07-30 16:21 ` Martin J. Bligh
2002-07-30 16:38 ` Scott Kaplan
2002-07-30 16:52 ` Martin J. Bligh
2002-08-05 18:54 ` Scott Kaplan
2002-07-30 17:13 ` William Lee Irwin III
2002-07-26 20:14 ` Stephen Lord
2002-07-26 20:29 ` Andrew Morton
2002-07-26 6:53 ` Daniel Phillips
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=95C024B4-A298-11D6-A4C0-000393829FA4@cs.amherst.edu \
--to=sfkaplan@cs.amherst.edu \
--cc=akpm@zip.com.au \
--cc=hch@lst.de \
--cc=linux-mm@kvack.org \
--cc=riel@conectiva.com.br \
--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