linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Horrible L2 cache effects from kernel compile
@ 2003-02-25  0:41 Dave Hansen
  2003-02-25  0:59 ` William Lee Irwin III
  2003-02-25  2:31 ` Linus Torvalds
  0 siblings, 2 replies; 27+ messages in thread
From: Dave Hansen @ 2003-02-25  0:41 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Martin J. Bligh, Gerrit Huizenga

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.

Counter 0 counted DCU_MISS_OUTSTANDING events (number of cycles while
DCU miss outstanding) with a unit mask of 0x00 (Not set) count 10000
c017d78c 72929    1.92175     start_this_handle
c0139b60 75317    1.98468     vm_enough_memory
c0138cd4 75367    1.986       do_no_page
c01ccae0 79475    2.09425     atomic_dec_and_lock
c0117320 80918    2.13227     scheduler_tick
c0176338 90851    2.39402     ext3_dirty_inode
c013cc38 132228   3.48434     page_remove_rmap
c0176557 148116   3.90301     .text.lock.inode
c013cae0 156345   4.11985     page_add_rmap
c012c964 157716   4.15598     find_get_page
c015797c 314165   8.27857     d_lookup
c01cc948 334779   8.82177     __copy_to_user_ll

a snippet from d_lookup(), annotated.  I've seen oprofile be off by a
line here, but we can be pretty sure it is in this area.
		...
		smp_read_barrier_depends();
		/* 106 0.002793% */
		dentry = list_entry(tmp, struct dentry, d_hash);

		/* if lookup ends up in a different bucket
		 * due to concurrent rename, fail it
		 */
		/* 154991 4.084% */
		if (unlikely(dentry->d_bucket != head))
			break;

		/* to avoid race if dentry keep coming back to original
		 * bucket due to double moves
		 */
		/* 634 0.01671% */
		if (unlikely(++lookup_count > max_dentries))
			break;
		...

-- 
Dave Hansen
haveblue@us.ibm.com


^ permalink raw reply	[flat|nested] 27+ messages in thread
[parent not found: <3E5ABBC1.8050203@us.ibm.com.suse.lists.linux.kernel>]
* Re: Horrible L2 cache effects from kernel compile
@ 2003-02-25 18:37 Manfred Spraul
  2003-02-25 18:41 ` Dave Hansen
                   ` (3 more replies)
  0 siblings, 4 replies; 27+ messages in thread
From: Manfred Spraul @ 2003-02-25 18:37 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, Dave Hansen

Andi wrote:

>The reason:
>
>Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
>Inode cache hash table entries: 65536 (order: 7, 524288 bytes)
>
>(1GB) I bet on your big memory box it is even worse. No cache
>in the world can cache that.
>
[snip]

>Try the appended experimental patch. It replaces the hash table madness
>with relatively small fixed tables.
>  
>
Are you sure that this will help?
With a smaller table, you might cause fewer cache misses for the table 
lookup. Instead you get longer hash chains. Walking linked lists 
probably causes more cache line misses than the single array lookup.

Dave, how many entries are in the dcache?

Btw, has anyone tried to replaced the global dcache with something 
local, perhaps a tree instead of d_child, and then lookup in d_child_tree?

--
    Manfred


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2003-03-05 20:09 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).