From: Vlastimil Babka <vbabka@suse.cz>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Rustam Kovhaev <rkovhaev@gmail.com>
Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com,
iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
djwong@kernel.org, david@fromorbit.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk,
dvyukov@google.com
Subject: Re: [PATCH] slob: add size header to all allocations
Date: Thu, 21 Oct 2021 19:36:26 +0200 [thread overview]
Message-ID: <1dfb7a79-3e66-a9fe-ee7c-1277d7ff5950@suse.cz> (raw)
In-Reply-To: <20211020114638.GA378758@kvm.asia-northeast3-a.c.our-ratio-313919.internal>
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.
>
>>
>> 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.
> Thanks,
> Hyeonggon
>
>> meminfo right after the system boot, without the patch:
>> Slab: 35500 kB
>>
>> the same, with the patch:
>> Slab: 36396 kB
>>
>
next prev parent reply other threads:[~2021-10-21 17:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 21:23 [PATCH] xfs: use kmem_cache_free() for kmem_cache objects Rustam Kovhaev
2021-09-30 4:42 ` Dave Chinner
2021-09-30 8:13 ` Vlastimil Babka
2021-09-30 18:48 ` Rustam Kovhaev
2021-09-30 21:10 ` Vlastimil Babka
2021-10-01 0:32 ` Rustam Kovhaev
2021-10-04 1:07 ` David Rientjes
2021-10-12 20:43 ` Darrick J. Wong
2021-10-12 20:43 ` Darrick J. Wong
2021-10-12 21:32 ` Vlastimil Babka
2021-10-12 23:22 ` Darrick J. Wong
2021-10-13 7:38 ` Vlastimil Babka
2021-10-13 16:56 ` Rustam Kovhaev
2021-10-15 0:57 ` Darrick J. Wong
2021-10-18 3:38 ` [PATCH] slob: add size header to all allocations Rustam Kovhaev
2021-10-18 9:22 ` Vlastimil Babka
2021-10-19 1:22 ` Rustam Kovhaev
2021-10-20 11:46 ` Hyeonggon Yoo
2021-10-21 17:36 ` Vlastimil Babka [this message]
2021-10-23 6:41 ` [PATCH v2] " Rustam Kovhaev
2021-10-25 9:36 ` Vlastimil Babka
2021-10-25 21:49 ` Rustam Kovhaev
2021-10-29 3:05 ` [PATCH v3] " Rustam Kovhaev
2021-11-16 11:26 ` Vlastimil Babka
2021-11-16 23:19 ` Rustam Kovhaev
2021-11-22 1:30 ` [PATCH v4] " Rustam Kovhaev
2021-11-22 9:22 ` Christoph Lameter
2021-11-22 9:40 ` Vlastimil Babka
2021-11-22 10:36 ` Christoph Lameter
2021-11-22 10:45 ` Vlastimil Babka
2021-11-22 11:40 ` Christoph Lameter
2021-11-22 11:49 ` Vlastimil Babka
2021-11-23 10:18 ` David Laight
2021-11-30 7:00 ` Rustam Kovhaev
2021-11-30 9:23 ` David Laight
2021-11-30 9:41 ` Christoph Lameter
2021-11-30 14:55 ` Vlastimil Babka
2021-11-30 15:21 ` David Laight
2021-11-30 15:39 ` Vlastimil Babka
2021-11-30 15:26 ` Christoph Lameter
2021-10-24 10:43 ` [PATCH] " Hyeonggon Yoo
2021-10-25 8:19 ` Vlastimil Babka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1dfb7a79-3e66-a9fe-ee7c-1277d7ff5950@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=rkovhaev@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).