[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66de652b-3c0d-4ad7-a23e-2a46e862edd7@suse.cz>
Date: Thu, 15 Jan 2026 11:11:16 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Hao Li <hao.li@...ux.dev>
Cc: Harry Yoo <harry.yoo@...cle.com>, Petr Tesarik <ptesarik@...e.com>,
Christoph Lameter <cl@...two.org>, David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Uladzislau Rezki <urezki@...il.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Alexei Starovoitov <ast@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-rt-devel@...ts.linux.dev,
bpf@...r.kernel.org, kasan-dev@...glegroups.com
Subject: Re: [PATCH RFC v2 05/20] slab: introduce percpu sheaves bootstrap
On 1/13/26 13:49, Hao Li wrote:
> On Mon, Jan 12, 2026 at 04:16:59PM +0100, Vlastimil Babka wrote:
>> @@ -8641,12 +8690,10 @@ int do_kmem_cache_create(struct kmem_cache *s, const char *name,
>>
>> set_cpu_partial(s);
>>
>> - if (s->sheaf_capacity) {
>> - s->cpu_sheaves = alloc_percpu(struct slub_percpu_sheaves);
>> - if (!s->cpu_sheaves) {
>> - err = -ENOMEM;
>> - goto out;
>> - }
>> + s->cpu_sheaves = alloc_percpu(struct slub_percpu_sheaves);
>
> Since we allocate cpu_sheaves for all SLUB caches, the "if (!s->cpu_sheaves)"
> condition in has_pcs_used() should be always false in practice (unless I'm
> misunderstanding something). Would it make sense to change it to "if
> (!s->sheaf_capacity)" instead?
Right.
> Also, while trying to understand the difference between checking s->cpu_sheaves
> vs s->sheaf_capacity, I noticed that most occurrences of "if (s->cpu_sheaves)"
> (except the one in __kmem_cache_release) could be expressed as "if
> (s->sheaf_capacity)" as well.
>
> And Perhaps we could introduce a small helper around "if (s->sheaf_capacity)" to
> make the intent a bit more explicit.
Good idea, will do. Thanks!
Powered by blists - more mailing lists