linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: 赵军奎 <bernard@vivo.com>
Cc: 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
Subject: Re: Re: [PATCH V2] kmalloc_index optimization(code size & runtime stable)
Date: Tue, 21 Apr 2020 07:36:09 -0700	[thread overview]
Message-ID: <20200421143609.GM5820@bombadil.infradead.org> (raw)
In-Reply-To: <AGEAdwClCFexXOQCGFZtCqqi.3.1587470103606.Hmail.bernard@vivo.com>

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?


  reply	other threads:[~2020-04-21 14:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  3:25 [PATCH V2] kmalloc_index optimization(code size & runtime stable) Bernard Zhao
2020-04-21 11:18 ` Matthew Wilcox
2020-04-21 11:55   ` 赵军奎
2020-04-21 14:36     ` Matthew Wilcox [this message]
2020-04-22  1:12       ` Re:Re: " 赵军奎
2020-04-21 13:13 ` 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=20200421143609.GM5820@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bernard@vivo.com \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=opensource.kernel@vivo.com \
    --cc=penberg@kernel.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 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).