Re: Page allocator: Single Zone optimizations

Andrew Morton
2006-11-03T22:12:18Z

On Fri, 3 Nov 2006 13:53:55 -0800 (PST)
Christoph Lameter <clameter@sgi.com> wrote:

> On Fri, 3 Nov 2006, Andrew Morton wrote:
>
> > > Kernel pages are buffered already in the slab
> > > allocator
> >
> > But why? I've been intermittently campaigning to stop doing that for about
> > five years now. Having private lists of free pages in the slab allocator
> > is duplicative of the page allocator's lists and worsens performance.
>
> This has to do with the constructors and the destructors. They are only
> applied during the first allocation or the final deallocation of the slab.
> The slab (with the pages) stays on the freelist with all objects having
> proper values as set by the constructors.

That's possibly useful if the cache has a destructor. If it has a
constructor and no destructor then there's no point in locally caching the
pages.

But destructors are a bad idea: you dirty a cacheline, evict something else
and then let the cacheline just sit there and go stale.

But I thought that slab once-upon-a-time retained caches of plain old free
pages, not in any particular state. Maybe it did and maybe we did remove
that.