All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Nick Craig-Wood <ncw1@axis.demon.co.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, Rohit Seth <rohit.seth@intel.com>
Subject: Re: 2.6.0 Huge pages not working as expected
Date: Fri, 26 Dec 2003 12:33:58 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0312261226560.14874@home.osdl.org> (raw)
In-Reply-To: <20031226201011.GA32316@axis.demon.co.uk>



On Fri, 26 Dec 2003, Nick Craig-Wood wrote:
> 
> The results are just about the same - a slight slowdown for
> hugepages...

I don't think you are really testing the TLB - you are testing the data 
cache.

And the thing is, using huge pages will mean that the pages are 1:1
mapped, and thus get "perfectly" cache-coloured, while the anonymous mmap 
will give you random placement.

And what you are seeing is likely the fact that random placement is 
guaranteed to not have any worst-case behaviour. While perfect 
cache-coloring very much _does_ have worst-case schenarios, and you're 
likely triggering one of them.

In particular, using a pure power-of-two stride means that you are
limiting your cache to a certain subset of the full result with the
perfect coloring.

This, btw, is why I don't like page coloring: it does give nicely
reproducible results, but it does not necessarily improve performance.  
Random placement has a lot of advantages, one of which is a lot smoother
performance degradation - which I personally think is a good thing.

Try your program with non-power-of-two, and non-page-aligned strides. I
suspect the results will change (but I suspect that the TLB wins will 
still be pretty much in the noise compared to the actual data cache 
effects).

		Linus

  parent reply	other threads:[~2003-12-26 20:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-26 10:54 2.6.0 Huge pages not working as expected Nick Craig-Wood
2003-12-26 11:56 ` William Lee Irwin III
2003-12-26 20:10   ` Nick Craig-Wood
2003-12-26 20:15     ` William Lee Irwin III
2003-12-26 20:33     ` Linus Torvalds [this message]
2003-12-27  3:36       ` Andrea Arcangeli
2003-12-27  4:01         ` Linus Torvalds
2003-12-27  9:28           ` David S. Miller
2003-12-27 15:58           ` Andrea Arcangeli
2003-12-27  9:01       ` Nick Craig-Wood
2004-01-06 14:24     ` Kurt Garloff

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=Pine.LNX.4.58.0312261226560.14874@home.osdl.org \
    --to=torvalds@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncw1@axis.demon.co.uk \
    --cc=rohit.seth@intel.com \
    --cc=wli@holomorphy.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.