From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: "Harry Yoo (Oracle)" <harry@kernel.org>
Cc: Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
hu.shengming@zte.com.cn,
Vinicius Costa Gomes <vinicius.gomes@intel.com>
Subject: Re: [PATCH RFC v2] mm, slab: add an optimistic __slab_try_return_freelist()
Date: Thu, 14 May 2026 14:54:45 +0200 [thread overview]
Message-ID: <a67c7265-4a67-4454-a146-ed729e08e063@kernel.org> (raw)
In-Reply-To: <ilvntlpu67ihrbna6hps62flwtiwrwddljoqg6olos7c3qstz7@gsxg5bhcnwbz>
On 5/12/26 07:49, Harry Yoo (Oracle) wrote:
> On Mon, Apr 27, 2026 at 11:42:57AM +0200, Vlastimil Babka (SUSE) wrote:
>> When we end up returning extraneous objects during refill to a slab
>> where we just did a get_freelist_nofreeze(), it is likely no other CPU
>> has freed objects to it meanwhile. We can then reattach the remainder of
>> the freelist without having to walk the (potentially cache cold)
>> freelist for finding its tail to connect slab->freelist to it.
>>
>> Add a __slab_try_return_freelist() function that does that. As suggested
>> by Hao Li, it doesn't need to also return the slab to the partial list,
>> because there's code in __refill_objects_node() that already does that
>> for any slabs where we don't detach the freelist in the first place.
>>
>> Reviewed-by: Hao Li <hao.li@linux.dev>
>> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
>> ---
>> Optimizes the current refill leftover handling in a way that should have
>> no downsides, so we have a better baseline for any further changes (e.g.
>> spilling or caching the leftover) that involve some tradeoffs.
>>
>> Git version here:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=b4/refill-optimistic-return
>>
>> It's based on slab/for-7.2/perf with "mm/slub: defer freelist
>> construction until after bulk allocation from a new slab".
>> ---
>> Changes in v2:
>> - rebase to slab/for-7.2/perf, drop RFC
>> - simplify to reuse the existing reattaching to partial list (Hao Li)
>> - Add R-b from Hao Li, thanks!
>> - drop the stat items - they serverd to verify the optimistic path was
>> succeeding, but are too detailed for mainline
>> - Link to v1: https://patch.msgid.link/20260421-b4-refill-optimistic-return-v1-1-24f0bfc1acff@kernel.org
>> ---
>
> Looks good to me,
> Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
Thanks!
> with a few typo fixes below.
Fixed up.
prev parent reply other threads:[~2026-05-14 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 9:42 [PATCH RFC v2] mm, slab: add an optimistic __slab_try_return_freelist() Vlastimil Babka (SUSE)
2026-05-12 5:49 ` Harry Yoo (Oracle)
2026-05-14 12:54 ` Vlastimil Babka (SUSE) [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=a67c7265-4a67-4454-a146-ed729e08e063@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 \
--cc=vinicius.gomes@intel.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