From: vbabka@kernel.org
To: Qing Wang <wangqing7171@gmail.com>
Cc: akpm@linux-foundation.org, cl@gentwo.org, hao.li@linux.dev,
harry.yoo@oracle.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, rientjes@google.com,
roman.gushchin@linux.dev
Subject: Re: [PATCH] slab: remove alloc_full_sheaf()
Date: Thu, 12 Mar 2026 10:10:54 +0100 [thread overview]
Message-ID: <bda340f2-1d49-4ff3-bfae-e3065607e918@kernel.org> (raw)
In-Reply-To: <20260312033105.593829-1-wangqing7171@gmail.com>
On 3/12/26 04:31, Qing Wang wrote:
> On Thu, 12 Mar 2026 at 02:22, "Vlastimil Babka (SUSE)" <vbabka@kernel.org> wrote:
>> - if (!full)
>> + if (refill_sheaf(s, empty, gfp | __GFP_NOMEMALLOC | __GFP_NOWARN)) {
>> + /*
>> + * we must be very low on memory so don't bother
>> + * with the barn
>> + */
>> + sheaf_flush_unused(s, empty);
>> + free_empty_sheaf(s, empty);
>> +
>> return NULL;
>> + }
>> +
>> + full = empty;
>> + empty = NULL;
>
> 'empty = NULL' is meaningless since 'empty' is not used after here.
Exactly, it's only for humans reading the code to make it explicit. And if
someone tries to make a change that will start using empty, it will oops
immediately instead of something more subtle.
>>
>> if (!local_trylock(&s->cpu_sheaves->lock))
>> goto barn_put;
>> pcs = this_cpu_ptr(s->cpu_sheaves);
>>
>> /*
>> - * If we are returning empty sheaf, we either got it from the
>> - * barn or had to allocate one. If we are returning a full
>> - * sheaf, it's due to racing or being migrated to a different
>> - * cpu. Breaching the barn's sheaf limits should be thus rare
>> - * enough so just ignore them to simplify the recovery.
>> + * If we put any empty or full sheaf to the barn below, it's due to
>> + * racing or being migrated to a different cpu. Breaching the barn's
>> + * sheaf limits should be thus rare enough so just ignore them to
>> + * simplify the recovery.
>> */
>>
>> if (pcs->main->size == 0) {
>
> LGTM.
>
> Reviewed-by: Qing Wang <wangqing7171@gmail.com>
Thanks!
> --
> Cheers,
> Qing
next prev parent reply other threads:[~2026-03-12 9:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 18:22 [PATCH] slab: remove alloc_full_sheaf() Vlastimil Babka (SUSE)
2026-03-12 3:31 ` Qing Wang
2026-03-12 9:10 ` vbabka [this message]
2026-03-12 9:27 ` Qing Wang
2026-03-12 4:36 ` Harry Yoo
2026-03-12 4:51 ` Hao Li
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=bda340f2-1d49-4ff3-bfae-e3065607e918@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=wangqing7171@gmail.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