Re: [PATCH] Cpuset: rcu optimization of page alloc hook

Andrew Morton
2005-12-12T10:13:53Z

Paul Jackson <pj@sgi.com> wrote:
>
> > Please do use __read_mostly for new kmem_cache :
> >
> > static kmem_cache_t *cpuset_cache __read_mostly;
>
> Is there any downside to this? I ask because accesses through
> this 'cpuset_cache' pointer are rather infrequent - only when
> the sysadmin or the batch scheduler is creating or removing
> cpusets, which for the purposes of 'back of the envelope'
> estimates, might be once a minute or less. Further, it is
> not at all a performance critical path.
>
> So I really don't give a dang if it takes a few milliseconds
> to pick up this pointer, at least so far as cpusets matters.

There's no downside, really. It just places the storage into a different
section. There's a small downside to having __read_mostly at all: up to a
page more memory used. But once it's there, adding to it is just moving
things around in memory.

__read_mostly is simply a new (page-aligned) section into we put things
which are considered to not be written to very often.

> That said, would you still advise marking this __read_mostly?

Not at this stage - it'd be better if someone did a big sweep and changed
all kmem_cache_t's in one hit.