Re: [PATCH UPDATED] percpu: use dynamic percpu allocator as the default percpu allocator

Linus Torvalds
2009-04-01T19:59:46Z

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