lkml.org 
[lkml]   [2020]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe:Re: Re: [PATCH V2] kmalloc index optimization(code size & runtime stable)
From
Date


发件人:Matthew Wilcox <willy@infradead.org>
发送日期:2020-04-21 22:36:09
收件人:"赵军奎" <bernard@vivo.com>
抄送人:Christoph Lameter <cl@linux.com>,Pekka Enberg <penberg@kernel.org>,David Rientjes <rientjes@google.com>,Joonsoo Kim <iamjoonsoo.kim@lge.com>,Andrew Morton <akpm@linux-foundation.org>,linux-mm@kvack.org,linux-kernel@vger.kernel.org,opensource.kernel@vivo.com
主题:Re: Re: [PATCH V2] kmalloc_index optimization(code size & runtime stable)>On Tue, Apr 21, 2020 at 07:55:03PM +0800, 赵军奎 wrote:
>> Sure, i just received some kbuild compiler error mails and prompt me to do something?
>> I don`t know why this happened, so i update the patch again.
>
>Don't. The patch has been NACKed, so there's no need to post a v2.
>
>If you want to do something useful, how about looking at the effect
>of adding different slab sizes? There's a fairly common pattern of
>allocating things which are a power of two + a header. So it may make
>sense to have kmalloc caches of 320 (256 + 64), 576 (512 + 64) and 1088
>(1024 + 64). I use 64 here as that's the size of a cacheline, so we
>won't get false sharing between users.
>
>This could save a fair quantity of memory; today if you allocate 512 +
>8 bytes, it will round up to 1024. So we'll get 4 allocations per 4kB
>page, but with a 576-byte slab, we'd get 7 allocations per 4kB page.
>Of course, if there aren't a lot of users which allocate memory in this
>range, then it'll be a waste of memory. On my laptop, it seems like
>there might be a decent amount of allocations in the right range:
>
>kmalloc-2k 3881 4384 2048 16 8 : tunables 0 0 0 : sla
>bdata 274 274 0
>kmalloc-1k 6488 7056 1024 16 4 : tunables 0 0 0 : slabdata 441 441 0
>kmalloc-512 7700 8256 512 16 2 : tunables 0 0 0 : slabdata 516 516 0
>
>Now, maybe 576 isn't quite the right size. Need to try it on a variety
>of configurations and find out. Want to investigate this?

This looks like a great idea!
Maybe I can do some research on our mobile phone products,
and see how the original size of kmalloc is distributed.
This may be useful as a reference to provide a flexible configuration method.
Thank you very much for your sharing.

Regards,
Bernard


\
 
 \ /
  Last update: 2020-04-22 03:12    [W:0.155 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site