From: David Ashley <dash@xdr.com>
To: linux-kernel@vger.kernel.org
Subject: Idea for improving linux buffer cache behaviour
Date: Sat, 4 Oct 2003 08:34:57 -0700 [thread overview]
Message-ID: <200310041534.h94FYv0X007015@xdr.com> (raw)
Forgive me if this has already been thought of, or is obsolete, or is just
plain a bad idea, but here it is:
When I am doing large block device operations, such as ripping a DVD, the
cache gets loaded with all this data I don't care about (the contents of the
DVD itself). The cache data I care about is glibc, other shared libraries, and
binary executables like xterm + whatnot that I am constantly using. After
doing the large block operations, all that important data is no longer in the
cache, so it has to be reloaded from disk. It is then annoyingly slow to use
the machine for a while, especially each new executable that has to be loaded.
Performance is so much better when the stuff is sitting there in a ram cache.
Here's the idea: For each cache item, keep a count of how many times it has
been accessed (read). Also keep a count of how old the cache entry is. When
looking for cache data to free up to make space for a new cache entry, throw
out the data based on
1) Lowest access count looked at first to toss
2) If access counts equal, throw out oldest first
Actually you could have a "keep" rating on each cache entry. The higher the
rating the more you want to keep it in the cache. It could be this:
A * (access_count) - B * (age)
where A and B are positive numbers. Every time you go to cache something new
you increment a counter and store that in with the cache entry. The age of
the cache entry is the current value of the counter minus the cache entry's
value. A could be much larger than B.
The net result is commonly used items you very much want to remain in cache
always quickly get rated very highly as the system is used.
I'm using 2.4.20. Maybe 2.[5|6] does much more intelligent cache handling.
-Dave
PS cc me on replies, I don't read this group normally.
next reply other threads:[~2003-10-04 15:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-04 15:34 David Ashley [this message]
2003-10-04 19:14 ` Idea for improving linux buffer cache behaviour Rik van Riel
2003-10-05 5:34 ` Mike Fedyk
2003-10-05 17:26 ` Helge Hafting
2003-10-05 17:56 ` CJ
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=200310041534.h94FYv0X007015@xdr.com \
--to=dash@xdr.com \
--cc=linux-kernel@vger.kernel.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