Re: [PATCH UPDATED] percpu: use dynamic percpu allocator as thedefault percpu allocator

From: Linus Torvalds
Date: Wed Apr 01 2009 - 15:59:50 EST




On Wed, 1 Apr 2009, Ingo Molnar wrote:
>
> The rest (unannotated variables) is to be assumed "access-rarely" or
> "we-dont-care", by default. This is actually 95% of the global
> variables.

I'm not at all convinced that this is a good option.

The thing is, things like "read_mostly" or "access_rarely" may talk about
how we access those individual variables, but you're missing a _huge_
chunk of the puzzle if you ignore the _correlations_ of those accesses
with accesses to other variables.

The thign is, if you have variables 'a' and 'b', and they are always
accessed together, then it's probably worth it to put them in the same
cacheline.

And that is true EVEN IF 'b' is basically read-only, but 'a' is always
written to. Marking 'a' as read-only or read-mostly is actually a bad
idea, since the only thing it can ever result in is a bigger cache
footprint.

The fact that the read-only cacheline has "nicer" behavior is totally
irrelevant - it's still an extra cacheline that we're accessing. And they
aren't free, even if read-only cachelines that can be shared across CPU's
are certainly a lot cheaper than ones that bounce.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/