linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Muchun Song <songmuchun@bytedance.com>,
	cl@linux.com, penberg@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
	roman.gushchin@linux.dev
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, smuchun@gmail.com
Subject: Re: [PATCH v2] mm: slab: optimize memcg_slab_free_hook()
Date: Tue, 14 Jun 2022 14:59:02 +0200	[thread overview]
Message-ID: <66864da8-4eb4-f177-3518-dc4e16aa183a@suse.cz> (raw)
In-Reply-To: <YqGUb0s5Jw5EgKne@FVFYT0MHHV2J.usts.net>

On 6/9/22 08:34, Muchun Song wrote:
> On Fri, Apr 29, 2022 at 08:30:44PM +0800, Muchun Song wrote:
>> Most callers of memcg_slab_free_hook() already know the slab,  which could
>> be passed to memcg_slab_free_hook() directly to reduce the overhead of an
>> another call of virt_to_slab().  For bulk freeing of objects, the call of
>> slab_objcgs() in the loop in memcg_slab_free_hook() is redundant as well.
>> Rework memcg_slab_free_hook() and build_detached_freelist() to reduce
>> those unnecessary overhead and make memcg_slab_free_hook() can handle bulk
>> freeing in slab_free().
>> 
>> Move the calling site of memcg_slab_free_hook() from do_slab_free() to
>> slab_free() for slub to make the code clearer since the logic is weird
>> (e.g. the caller need to judge whether it needs to call
>> memcg_slab_free_hook()). It is easy to make mistakes like missing calling
>> of memcg_slab_free_hook() like fixes of:
>> 
>>   commit d1b2cf6cb84a ("mm: memcg/slab: uncharge during kmem_cache_free_bulk()")
>>   commit ae085d7f9365 ("mm: kfence: fix missing objcg housekeeping for SLAB")
>> 
>> This optimization is mainly for bulk objects freeing.  The following numbers
>> is shown for 16-object freeing.
>> 
>>                            before      after
>>   kmem_cache_free_bulk:   ~430 ns     ~400 ns
>> 
>> The overhead is reduced by about 7% for 16-object freeing.
>> 
>> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> 
> Hi Vlastimil,
> 
> Wolud you mind picking it up? I did not see this patch on the
> slab tree.

Sorry, was waiting for rc1 to start the for-5.20 branches and was away for
another week then. Now pushed to slab/for-5.20/optimizations

> Thanks.
> 



      reply	other threads:[~2022-06-14 12:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 12:30 Muchun Song
2022-05-08  5:58 ` Hyeonggon Yoo
2022-05-24 17:05 ` Vlastimil Babka
2022-05-25  2:18   ` Muchun Song
2022-05-25  7:34     ` Vlastimil Babka
2022-05-25  9:15       ` Muchun Song
2022-05-25 10:09         ` Vlastimil Babka
2022-05-25 10:29           ` Muchun Song
2022-06-09  6:34 ` Muchun Song
2022-06-14 12:59   ` 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=66864da8-4eb4-f177-3518-dc4e16aa183a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.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=roman.gushchin@linux.dev \
    --cc=smuchun@gmail.com \
    --cc=songmuchun@bytedance.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