From: Tim Bird <tim.bird@am.sony.com>
To: Ezequiel Garcia <elezegarcia@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
David Rientjes <rientjes@google.com>,
Andi Kleen <andi@firstfloor.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"celinux-dev@lists.celinuxforum.org"
<celinux-dev@lists.celinuxforum.org>
Subject: Re: [Q] Default SLAB allocator
Date: Tue, 16 Oct 2012 11:44:31 -0700 [thread overview]
Message-ID: <507DAB0F.30000@am.sony.com> (raw)
In-Reply-To: <CALF0-+VLVqy_uE63_jL83qh8MqBQAE3vYLRX1mRQURZ4a1M20g@mail.gmail.com>
On 10/16/2012 11:27 AM, Ezequiel Garcia wrote:
> On Tue, Oct 16, 2012 at 3:07 PM, Tim Bird <tim.bird@am.sony.com> wrote:
>> On 10/16/2012 05:56 AM, Eric Dumazet wrote:
>>> On Tue, 2012-10-16 at 09:35 -0300, Ezequiel Garcia wrote:
>>>
>>>> Now, returning to the fragmentation. The problem with SLAB is that
>>>> its smaller cache available for kmalloced objects is 32 bytes;
>>>> while SLUB allows 8, 16, 24 ...
>>>>
>>>> Perhaps adding smaller caches to SLAB might make sense?
>>>> Is there any strong reason for NOT doing this?
>>>
>>> I would remove small kmalloc-XX caches, as sharing a cache line
>>> is sometime dangerous for performance, because of false sharing.
>>>
>>> They make sense only for very small hosts.
>>
>> That's interesting...
>>
>> It would be good to measure the performance/size tradeoff here.
>> I'm interested in very small systems, and it might be worth
>> the tradeoff, depending on how bad the performance is. Maybe
>> a new config option would be useful (I can hear the groans now... :-)
>>
>> Ezequiel - do you have any measurements of how much memory
>> is wasted by 32-byte kmalloc allocations for smaller objects,
>> in the tests you've been doing?
>
> Yes, we have some numbers:
>
> http://elinux.org/Kernel_dynamic_memory_analysis#Kmalloc_objects
>
> Are they too informal? I can add some details...
> They've been measured on a **very** minimal setup, almost every option
> is stripped out, except from initramfs, sysfs, and trace.
>
> On this scenario, strings allocated for file names and directories
> created by sysfs
> are quite noticeable, being 4-16 bytes, and produce a lot of fragmentation from
> that 32 byte cache at SLAB.
The detail I'm interested in is the amount of wastage for a
"common" workload, for each of the SLxB systems. Are we talking a
few K, or 10's or 100's of K? It sounds like it's all from short strings.
Are there other things using the 32-byte kmalloc cache, that waste
a lot of memory (in aggregate) as well?
Does your tool indicate a specific callsite (or small set of callsites)
where these small allocations are made? It sounds like it's in the filesystem
and would be content-driven (by the length of filenames)?
This might be an issue particularly for cameras, where all the generated
filenames are 8.3 (and will be for the foreseeable future)
> Is an option to enable small caches on SLUB and SLAB worth it?
I'll have to do some measurements to see. I'm guessing the option
itself would be pretty trivial to implement?
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment
=============================
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Tim Bird <tim.bird@am.sony.com>
To: Ezequiel Garcia <elezegarcia@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
David Rientjes <rientjes@google.com>,
Andi Kleen <andi@firstfloor.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"celinux-dev@lists.celinuxforum.org"
<celinux-dev@lists.celinuxforum.org>
Subject: Re: [Q] Default SLAB allocator
Date: Tue, 16 Oct 2012 11:44:31 -0700 [thread overview]
Message-ID: <507DAB0F.30000@am.sony.com> (raw)
In-Reply-To: <CALF0-+VLVqy_uE63_jL83qh8MqBQAE3vYLRX1mRQURZ4a1M20g@mail.gmail.com>
On 10/16/2012 11:27 AM, Ezequiel Garcia wrote:
> On Tue, Oct 16, 2012 at 3:07 PM, Tim Bird <tim.bird@am.sony.com> wrote:
>> On 10/16/2012 05:56 AM, Eric Dumazet wrote:
>>> On Tue, 2012-10-16 at 09:35 -0300, Ezequiel Garcia wrote:
>>>
>>>> Now, returning to the fragmentation. The problem with SLAB is that
>>>> its smaller cache available for kmalloced objects is 32 bytes;
>>>> while SLUB allows 8, 16, 24 ...
>>>>
>>>> Perhaps adding smaller caches to SLAB might make sense?
>>>> Is there any strong reason for NOT doing this?
>>>
>>> I would remove small kmalloc-XX caches, as sharing a cache line
>>> is sometime dangerous for performance, because of false sharing.
>>>
>>> They make sense only for very small hosts.
>>
>> That's interesting...
>>
>> It would be good to measure the performance/size tradeoff here.
>> I'm interested in very small systems, and it might be worth
>> the tradeoff, depending on how bad the performance is. Maybe
>> a new config option would be useful (I can hear the groans now... :-)
>>
>> Ezequiel - do you have any measurements of how much memory
>> is wasted by 32-byte kmalloc allocations for smaller objects,
>> in the tests you've been doing?
>
> Yes, we have some numbers:
>
> http://elinux.org/Kernel_dynamic_memory_analysis#Kmalloc_objects
>
> Are they too informal? I can add some details...
> They've been measured on a **very** minimal setup, almost every option
> is stripped out, except from initramfs, sysfs, and trace.
>
> On this scenario, strings allocated for file names and directories
> created by sysfs
> are quite noticeable, being 4-16 bytes, and produce a lot of fragmentation from
> that 32 byte cache at SLAB.
The detail I'm interested in is the amount of wastage for a
"common" workload, for each of the SLxB systems. Are we talking a
few K, or 10's or 100's of K? It sounds like it's all from short strings.
Are there other things using the 32-byte kmalloc cache, that waste
a lot of memory (in aggregate) as well?
Does your tool indicate a specific callsite (or small set of callsites)
where these small allocations are made? It sounds like it's in the filesystem
and would be content-driven (by the length of filenames)?
This might be an issue particularly for cameras, where all the generated
filenames are 8.3 (and will be for the foreseeable future)
> Is an option to enable small caches on SLUB and SLAB worth it?
I'll have to do some measurements to see. I'm guessing the option
itself would be pretty trivial to implement?
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment
=============================
next prev parent reply other threads:[~2012-10-16 18:40 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 14:19 [Q] Default SLAB allocator Ezequiel Garcia
2012-10-11 14:19 ` Ezequiel Garcia
2012-10-11 22:42 ` Andi Kleen
2012-10-11 22:42 ` Andi Kleen
2012-10-11 22:59 ` David Rientjes
2012-10-11 22:59 ` David Rientjes
2012-10-11 23:10 ` Andi Kleen
2012-10-11 23:10 ` Andi Kleen
2012-10-12 12:07 ` Ezequiel Garcia
2012-10-12 12:07 ` Ezequiel Garcia
2012-10-13 9:54 ` David Rientjes
2012-10-13 9:54 ` David Rientjes
2012-10-13 12:44 ` Ezequiel Garcia
2012-10-13 12:44 ` Ezequiel Garcia
2012-10-16 0:46 ` David Rientjes
2012-10-16 0:46 ` David Rientjes
2012-10-16 12:35 ` Ezequiel Garcia
2012-10-16 12:35 ` Ezequiel Garcia
2012-10-16 12:56 ` Eric Dumazet
2012-10-16 12:56 ` Eric Dumazet
2012-10-16 18:07 ` Tim Bird
2012-10-16 18:07 ` Tim Bird
2012-10-16 18:27 ` Ezequiel Garcia
2012-10-16 18:27 ` Ezequiel Garcia
2012-10-16 18:44 ` Tim Bird [this message]
2012-10-16 18:44 ` Tim Bird
2012-10-16 18:49 ` Ezequiel Garcia
2012-10-16 18:49 ` Ezequiel Garcia
2012-10-16 19:16 ` Eric Dumazet
2012-10-16 19:16 ` Eric Dumazet
2012-10-17 18:45 ` Tim Bird
2012-10-17 18:45 ` Tim Bird
2012-10-17 19:13 ` Eric Dumazet
2012-10-17 19:13 ` Eric Dumazet
2012-10-17 19:20 ` Shentino
2012-10-17 19:20 ` Shentino
2012-10-17 20:33 ` Tim Bird
2012-10-17 20:33 ` Tim Bird
2012-10-18 0:46 ` Shentino
2012-10-18 0:46 ` Shentino
2012-10-17 20:58 ` Tim Bird
2012-10-17 20:58 ` Tim Bird
2012-10-17 21:05 ` Ezequiel Garcia
2012-10-17 21:05 ` Ezequiel Garcia
2012-10-16 18:36 ` Ezequiel Garcia
2012-10-16 18:36 ` Ezequiel Garcia
2012-10-16 18:54 ` Christoph Lameter
2012-10-16 18:54 ` Christoph Lameter
2012-10-13 9:51 ` David Rientjes
2012-10-13 9:51 ` David Rientjes
2012-10-13 15:10 ` Eric Dumazet
2012-10-13 15:10 ` Eric Dumazet
2012-10-16 1:28 ` JoonSoo Kim
2012-10-16 1:28 ` JoonSoo Kim
2012-10-16 7:23 ` Eric Dumazet
2012-10-16 7:23 ` Eric Dumazet
2012-10-19 0:03 ` JoonSoo Kim
2012-10-19 0:03 ` JoonSoo Kim
2012-10-19 7:01 ` Eric Dumazet
2012-10-19 7:01 ` Eric Dumazet
2012-10-16 0:45 ` David Rientjes
2012-10-16 0:45 ` David Rientjes
2012-10-16 18:53 ` Christoph Lameter
2012-10-16 18:53 ` Christoph Lameter
2012-10-16 19:02 ` Christoph Lameter
2012-10-16 19:02 ` Christoph Lameter
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=507DAB0F.30000@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=andi@firstfloor.org \
--cc=celinux-dev@lists.celinuxforum.org \
--cc=elezegarcia@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.