Re: [PATCH 3/4] mm: Add free()

From: Matthew Wilcox
Date: Sun Mar 25 2018 - 19:56:17 EST


On Fri, Mar 23, 2018 at 08:14:21AM -0700, Matthew Wilcox wrote:
> On Fri, Mar 23, 2018 at 04:33:24PM +0300, Kirill Tkhai wrote:
> > > + page = virt_to_head_page(ptr);
> > > + if (likely(PageSlab(page)))
> > > + return kmem_cache_free(page->slab_cache, (void *)ptr);
> >
> > It seems slab_cache is not generic for all types of slabs. SLOB does not care about it:
>
> Oof. I was sure I checked that. You're quite right that it doesn't ...
> this should fix that problem:

This patch was complete rubbish. The point of SLOB is that it mixes
sizes within the same page, and doesn't store the size when allocating
from a slab. So there is no way to tell. I'm going to think about this
some more.