All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Paul Jackson <pj@sgi.com>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, nickpiggin@yahoo.com.au,
	Simon.Derr@bull.net, ak@suse.de, clameter@sgi.com
Subject: Re: [PATCH] Cpuset: rcu optimization of page alloc hook
Date: Tue, 13 Dec 2005 17:31:25 +0100	[thread overview]
Message-ID: <439EF75D.50206@cosmosbay.com> (raw)
In-Reply-To: <20051213075345.c39f335d.pj@sgi.com>

Paul Jackson a écrit :

> 
> 
> Hmmm ... I suspect one possible downside.
> 
> I would think we would want to spread the hot spots out, to reduce the
> chance of getting two hot spots in the same cache line, and starting a
> bidding war for that line.
> 
> So my intuition is:
>   If read alot but seldom written, mark "__read_mostly".
>   If seldom read or written, leave unmarked.
> 

Your analysis is very good but not complete :)

There are different kind of hot cache lines, depending if they are :
- Mostly read
- read/written

Say you move to read mostly most of struct kmem_cache *, they are guaranteed 
to stay in 'mostly read'.

Mixing for example filp_cachep and dcache_lock in the same cache line is not a 
good thing. And this is what happening on typical kernel :

c04f15f0 B dcache_lock
c04f15f4 B names_cachep
c04f15f8 B filp_cachep
c04f15fc b rename_lock

I do think we should have defined a special section for very hot (and written) 
spots. It's more easy to locate thos hot spots than 'mostly read and shared by 
all cpus without cache ping pongs' places...




> so as to leave plenty of the rarely used (neither read nor written on
> kernel hot path code) as "cannon fodder" to fill the rest of the cache
> lines favored by the hot data.
> 
> This leads me to ask, of any item marked "__read_mostly":
> 
>   Is it accessed (for read, presumably) frequently, on a hot path?
> 
> If not, then I'd favor (absent actual measurements to the contrary) not
> marking it.
> 
> By this criteria:
> 
>   1) I would -not- mark "struct kmem_cache *cpuset" __read_mostly, as it
>      is rarely accessed on -any- code path, much less a hot one.  It is
>      ideal cannon fodder.
> 
>   2) I -would- (following a private email suggestion of Christoph Lameter)
>      mark my recently added "int number_of_cpusets" __read_mostly,
>      because it is accessed for every zone considered in the loops
>      within^Wbeneath __alloc_pages().
> 
> Disclaimer -- none of the above speculation is tempered by the heat of any
> actual performance measurements.  Hence, it is worth about as much as my
> legal advice.
> 


  reply	other threads:[~2005-12-13 16:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-11 23:31 [PATCH] Cpuset: rcu optimization of page alloc hook Paul Jackson
2005-12-12  3:29 ` Andi Kleen
2005-12-12  6:11   ` Paul Jackson
2005-12-12  6:21     ` Andi Kleen
2005-12-12  6:50       ` Paul Jackson
2005-12-12  8:49 ` Eric Dumazet
2005-12-12  8:54   ` Nick Piggin
2005-12-12  9:06     ` Eric Dumazet
2005-12-12  9:11     ` Andrew Morton
2005-12-12  9:38       ` Nick Piggin
2005-12-12 10:02   ` Paul Jackson
2005-12-12 10:12     ` Andrew Morton
2005-12-13 15:53       ` Paul Jackson
2005-12-13 16:31         ` Eric Dumazet [this message]
2005-12-13 17:42           ` Christoph Lameter
2005-12-13 17:56             ` Eric Dumazet
2005-12-13 18:07               ` Christoph Lameter
2005-12-13 21:03               ` Paul Jackson
2005-12-13 21:16                 ` Christoph Lameter
2005-12-13 21:38                 ` Eric Dumazet
2005-12-13 22:23                   ` Paul Jackson
2005-12-13 22:29                     ` Christoph Lameter
2005-12-14  3:54                     ` Paul Jackson
2005-12-14  4:02                       ` Andi Kleen
2005-12-14  4:06                         ` Paul Jackson
2005-12-14  8:06                     ` Eric Dumazet
2005-12-14  8:40                       ` Paul Jackson
2005-12-13 20:08           ` Paul Jackson
2005-12-13 20:29             ` Eric Dumazet
2005-12-13 22:35               ` Paul Jackson
2005-12-13 21:44           ` Paul Jackson
2005-12-13 17:37         ` Christoph Lameter

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=439EF75D.50206@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=Simon.Derr@bull.net \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=pj@sgi.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.