[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211024104340.GA4370@kvm.asia-northeast3-a.c.our-ratio-313919.internal>
Date: Sun, 24 Oct 2021 10:43:40 +0000
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Rustam Kovhaev <rkovhaev@...il.com>, cl@...ux.com,
penberg@...nel.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
akpm@...ux-foundation.org, djwong@...nel.org, david@...morbit.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
gregkh@...uxfoundation.org, viro@...iv.linux.org.uk,
dvyukov@...gle.com
Subject: Re: [PATCH] slob: add size header to all allocations
On Thu, Oct 21, 2021 at 07:36:26PM +0200, Vlastimil Babka wrote:
> On 10/20/21 13:46, Hyeonggon Yoo wrote:
> > On Sun, Oct 17, 2021 at 08:38:41PM -0700, Rustam Kovhaev wrote:
> >> Let's prepend all allocations of (PAGE_SIZE - align_offset) and less
> >> with the size header. This way kmem_cache_alloc() memory can be freed
> >> with kfree() and the other way around, as long as they are less than
> >> (PAGE_SIZE - align_offset).
> >
> > Hello Rustam, I measured its impact on memory usage on
> > tiny kernel configuration as SLOB is used in very small machine.
> >
> > on x86 32 bit + tinyconfig:
> > Before:
> > Slab: 668 kB
> >
> > After:
> > Slab: 688~692 kB
> >
> > it adds 20~24kB.
>
> Thanks for the measurement. That's 3.5% increase.
>
You're welcome.
> >
> >>
> >> The main reason for this change is to simplify SLOB a little bit, make
> >> it a bit easier to debug whenever something goes wrong.
> >>
> >
> > It seems acceptable But I wonder it is worth to increase memory usage
> > to allow freeing kmem_cache_alloc-ed objects by kfree()?
>
> Not for the reason above, but for providing a useful API guarantee
> regardless of selected slab allocator IMHO yes.
>
Mm.. that means some callers free kmem_cache_alloc-ed object using
kfree, and SLAB/SLUB already support that, and SLOB doesn't.
In what situations is freeing using kfree needed?
Wouldn't this make code confusing?
> > Thanks,
> > Hyeonggon
> >
> >> meminfo right after the system boot, without the patch:
> >> Slab: 35500 kB
> >>
> >> the same, with the patch:
> >> Slab: 36396 kB
> >>
> >
>
Powered by blists - more mailing lists