From: Andi Kleen <ak@suse.de>
To: jaharkes@cs.cmu.edu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] New dcache / inode hash tuning patch
Date: Sat, 1 Mar 2003 02:17:23 +0100 [thread overview]
Message-ID: <20030301011723.GA31126@wotan.suse.de> (raw)
In-Reply-To: <20030301004942.GA16973@delft.aura.cs.cmu.edu>
> The dentry cache hashtable currently has a fill-rate of about 10%, but
> I've been running a lot of compilations and updatedb hasn't been around
> for a long time. The VM has already aggressivly pruned it, which is to be
> expected. The inode cache hash table is at about 50%. So if the hash
> function is good we can assume that most hash chains are either empty or
The hash function isn't good and the hash chains are far from evenly
distributed. There are typically 30-40% empty buckets, while some
others are rather long.
In addition I think only a small fraction of the dentries are actually hot.
(no numbers on that, sorry)
Your 47MB number doesn't make much sense for lookup tuning because these
are not walked all the time. Only a few cache lines of the dentry are accessed
for a lookup.
If you think you have a better concept than me to tune it then feel
free to post a patch.
> Now from what I read of your patch, it limits the size of the inode hash
> table to 64KB, but with single pointers it can still address about 16000
> hash chains. Assuming the same perfect hash distribution, all chains
> will contain about 2 objects. So although the hash table fits much
> better, each time we are looking for an uncached object we need to walk
> 2 objects that are spread across that 47MB chunk of allocated inodes,
> instead of basically having a 'yes or no' answer pretty much from
> looking at the hash table.
Apply the latest hash patch and run some statistics over the bucket
distributions from /proc/dcache. You'll quickly see that your ideal model
does not match reality at all.
> Yes but you will never fit 47MB worth of inodes into that same 2MB
> cache. And I realize that you can align things so that you don't have
The overall cached inodes are not too interesting - it is a long known
problem of linux that it caches too many inodes. But it doesn't matter
here because the dcache does all the hard lookup work and it hash
direct pointers to the inodes (no inode hash lookup needed). Most of them
are just wasted memory, but luckily not wasted cache.
What's interesting is to make the dentry lookup as fast as possible.
> to pull in more than a few cache-lines per object, but traversing ~0.5
> pointers versus 2 pointers for every L1/L2 cache miss will be felt
> because each traversal will hit another L2 cache-line.
Sorry but the average 2 bucket length number is completely unrealistic.
It doesn't make any sense to use it in an argument.
>
> It is probably far more useful to restrain the sizes of the inode and
> dentry caches. Why would my system need 2-3 times the number of inodes
Limiting inode caches is probably a good idea. It's a long standing known
bug. At least definitely do prune inodes not referenced by the dcache
I believe some 2.4 trees fixed that in fact, but these fixes have
likely not moved to 2.5 yet. But really, it makes no difference
for these benchmarks, which have enough memory.
Limiting dcache is probably a bad idea. Recreating the dcache is far
slower than any hash lookup. And a lot of Linux's good interactive
performance comes from the aggressive dcache caching.
-Andi
next prev parent reply other threads:[~2003-03-01 1:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030226164904.GA21342@wotan.suse.de.suse.lists.linux.kernel>
[not found] ` <b3m5sd$1ad$1@penguin.transmeta.com.suse.lists.linux.kernel>
2003-02-28 8:34 ` Andi Kleen
2003-02-28 10:27 ` [Lse-tech] " Paul Menage
2003-02-28 10:40 ` Andi Kleen
2003-02-28 18:47 ` Linus Torvalds
2003-02-28 18:59 ` Andi Kleen
2003-03-01 0:49 ` Jan Harkes
2003-03-01 1:17 ` Andi Kleen [this message]
2003-03-01 4:31 ` Ed Tomlinson
2003-03-01 9:08 ` Andi Kleen
2003-03-01 12:34 ` Ed Tomlinson
2003-03-01 18:34 ` Linus Torvalds
2003-02-26 16:49 Andi Kleen
2003-02-27 23:10 ` Linus Torvalds
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=20030301011723.GA31126@wotan.suse.de \
--to=ak@suse.de \
--cc=jaharkes@cs.cmu.edu \
--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
all inboxes | Powered by JetHome®