The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: hu.shengming@zte.com.cn
Cc: harry@kernel.org, akpm@linux-foundation.org, hao.li@linux.dev,
	cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slab: extract __free_to_pcs_batch() from free_to_pcs_bulk()
Date: Wed, 8 Jul 2026 18:32:23 +0200	[thread overview]
Message-ID: <fe17cf26-f745-442f-a026-3d20fc6b3307@kernel.org> (raw)
In-Reply-To: <20260707233433577tAGELJALunrdd2lZy83V-@zte.com.cn>

On 7/7/26 17:34, hu.shengming@zte.com.cn wrote:
> Vlastimil wrote:
>> It has been noted that free_to_pcs_bulk() is difficult to follow, with a
>> number of goto labels, and this has contributed to two memory leak bugs
>> in there.
>> 
>> Extract part of the code to __free_to_pcs_batch(), which focuses only on
>> freeing free-hook-processed local objects to a percpu sheaf, and
>> returning how many were freed. Zero means a trylock failure or no empty
>> sheaf available, and thus the caller should fallback to
>> __kmem_cache_free_bulk().
>> 
>> Make free_to_pcs_bulk() call this in a while loop, removing all goto
>> labels from the function. __free_to_pcs_batch() retains two rather
>> straightforward ones.
> 
> Hi Vlastimil,
> 
> This looks like a very nice refactoring to me. Splitting out the actual
> per-CPU sheaf batching into __free_to_pcs_batch() makes the control flow
> in free_to_pcs_bulk() much easier to follow, and also keeps the fallback
> handling clearer.
> 
> Please feel free to add:
> Reviewed-by: Shengming Hu <hu.shengming@zte.com.cn>

Thanks!

Added to slab/for-next


  reply	other threads:[~2026-07-08 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 12:16 [PATCH] mm/slab: extract __free_to_pcs_batch() from free_to_pcs_bulk() Vlastimil Babka (SUSE)
2026-07-07 15:34 ` hu.shengming
2026-07-08 16:32   ` Vlastimil Babka (SUSE) [this message]
2026-07-10  5:18 ` Hao Li
2026-07-10  5:21   ` Hao Li
2026-07-10  9:54     ` Vlastimil Babka (SUSE)
2026-07-10 10:02       ` Harry Yoo

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=fe17cf26-f745-442f-a026-3d20fc6b3307@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=hu.shengming@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    /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