mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Abel Wu <abel.w@icloud.com>, Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	hewenliang4@huawei.com, wuyun.wu@huawei.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slub: embed __slab_alloc to its caller
Date: Fri, 5 Feb 2021 14:03:57 +0100	[thread overview]
Message-ID: <30743bfa-fbbb-c091-3b6e-dc24975fc6c3@suse.cz> (raw)
In-Reply-To: <9A811B32-6E3D-4FE1-98A5-A7922C32CDB4@icloud.com>

On 2/3/21 2:41 AM, Abel Wu wrote:
>> On Feb 2, 2021, at 6:11 PM, Christoph Lameter <cl@linux.com> wrote:
>> 
>> On Tue, 2 Feb 2021, Abel Wu wrote:
>> 
>>> Since slab_alloc_node() is the only caller of __slab_alloc(), embed
>>> __slab_alloc() to its caller to save function call overhead. This
>>> will also expand the caller's code block size a bit, but hackbench
>>> tests on both host and guest didn't show a difference w/ or w/o
>>> this patch.
>> 
>> slab_alloc_node is an always_inline function. It is intentional that only
>> the fast path was inlined and not the slow path.
> 
> Oh I got it. Thanks for your excellent explanation.

BTW, there's a script in the Linux source to nicely see the effect of such changes:

./scripts/bloat-o-meter slub.o.before mm/slub.o
add/remove: 0/1 grow/shrink: 9/0 up/down: 1660/-1130 (530)
Function                                     old     new   delta
__slab_alloc                                 127    1130   +1003
__kmalloc_track_caller                       877     965     +88
__kmalloc                                    878     966     +88
kmem_cache_alloc                             778     862     +84
__kmalloc_node_track_caller                  996    1080     +84
kmem_cache_alloc_node_trace                  813     896     +83
kmem_cache_alloc_node                        800     881     +81
kmem_cache_alloc_trace                       786     862     +76
__kmalloc_node                               998    1071     +73
___slab_alloc                               1130       -   -1130
Total: Before=57782, After=58312, chg +0.92%

And yeah, bloating all the entry points wouldn't be nice.
Thanks,
Vlastimil

      reply	other threads:[~2021-02-05 13:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  8:05 Abel Wu
2021-02-02 10:11 ` Christoph Lameter
2021-02-03  1:41   ` Abel Wu
2021-02-05 13:03     ` Vlastimil Babka [this message]

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=30743bfa-fbbb-c091-3b6e-dc24975fc6c3@suse.cz \
    --to=vbabka@suse.cz \
    --cc=abel.w@icloud.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=hewenliang4@huawei.com \
    --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=wuyun.wu@huawei.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

all inboxes | Powered by JetHome®