public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: Horrible L2 cache effects from kernel compile
Date: Tue, 25 Feb 2003 02:31:49 +0000 (UTC)	[thread overview]
Message-ID: <b3ekil$1cp$1@penguin.transmeta.com> (raw)
In-Reply-To: 3E5ABBC1.8050203@us.ibm.com

In article <3E5ABBC1.8050203@us.ibm.com>,
Dave Hansen  <haveblue@us.ibm.com> wrote:
>I was testing Martin Bligh's kernbench (a kernel compile with
>-j(2*NR_CPUS)) and using DCU_MISS_OUTSTANDING as the counter event.
>
>The surprising thing?  d_lookup() accounts for 8% of the time spent
>waiting for an L2 miss.
>
>__copy_to_user_ll should be trashing a lot of cachelines, but d_lookup()
>is strange.

I wouldn't call it that strange. It _is_ one of the most critical areas
of the FS code, and hashes (which it uses) are inherently bad for caches. 

The instruction you point to as being the most likely suspect:

	if (unlikely(dentry->d_bucket != head))

is the first instruction that actually looks at the dentry chain
information, so sure as hell, that's the one you'd expect to show up as
the cache miss.

There's no question that the dcache is very effective at caching, but I
also think it's pretty clear that especially since we allow it to grow
pretty much as big as we have memory, it _is_ going to cause cache misses.

I don't know what to even suggest doing about it - it may be one of
those things where we just have to live with it.  I don't see any
alternate good data structures that would be more cache-friendly. 
Unlike some of our other data structures (the page cache, for example)
which have been converted to more cache-friendly RB-trees, the name
lookup is fundamentally not very well-behaved.

(Ie with the page cache there is a lot of locality within one file,
while with name lookup the indexing is a string, which pretty much
implies that we have to hash it and thus lose all locality)

			Linus

  parent reply	other threads:[~2003-02-25  2:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-25  0:41 Horrible L2 cache effects from kernel compile Dave Hansen
2003-02-25  0:59 ` William Lee Irwin III
2003-02-25  1:01   ` Dave Hansen
2003-02-25  3:15   ` John Levon
2003-02-25  3:15     ` William Lee Irwin III
2003-02-25  3:35     ` Andrew Morton
2003-02-25  4:13       ` Martin J. Bligh
2003-02-25 11:57         ` John Levon
2003-02-25  2:31 ` Linus Torvalds [this message]
2003-02-25 17:05   ` John W. M. Stevens
     [not found] <3E5ABBC1.8050203@us.ibm.com.suse.lists.linux.kernel>
2003-02-25 16:16 ` Andi Kleen
2003-02-27  3:24   ` Dave Hansen
2003-02-27 16:36   ` Jan Harkes
     [not found] ` <b3ekil$1cp$1@penguin.transmeta.com.suse.lists.linux.kernel>
     [not found]   ` <20030225170546.GA23772@morningstar.nowhere.lie.suse.lists.linux.kernel>
2003-02-25 17:20     ` Andi Kleen
2003-02-26 18:22       ` Jamie Lokier
  -- strict thread matches above, loose matches on Subject: below --
2003-02-25 18:37 Manfred Spraul
2003-02-25 18:41 ` Dave Hansen
2003-02-25 18:42 ` Andi Kleen
2003-02-25 19:29 ` Martin J. Bligh
2003-02-25 22:18 ` Linus Torvalds
2003-03-03 19:03   ` Benjamin LaHaise
2003-03-03 19:13     ` Linus Torvalds
2003-03-03 23:58       ` Alan Cox
2003-03-03 22:57         ` Andrew Morton
2003-03-03 23:01         ` Benjamin LaHaise
2003-03-03 23:09         ` Linus Torvalds
2003-03-05 20:19         ` dean gaudet

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='b3ekil$1cp$1@penguin.transmeta.com' \
    --to=torvalds@transmeta.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