[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <effcb710-122b-44b8-91d3-5cef727ad4fa@suse.cz>
Date: Thu, 29 Jan 2026 09:25:18 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
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>, Hao Li <hao.li@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Uladzislau Rezki <urezki@...il.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 v4 08/22] slab: make percpu sheaves compatible with
kmalloc_nolock()/kfree_nolock()
On 1/27/26 18:36, Liam R. Howlett wrote:
> * Vlastimil Babka <vbabka@...e.cz> [260123 01:54]:
>> Before we enable percpu sheaves for kmalloc caches, we need to make sure
>> kmalloc_nolock() and kfree_nolock() will continue working properly and
>> not spin when not allowed to.
>>
>> Percpu sheaves themselves use local_trylock() so they are already
>> compatible. We just need to be careful with the barn->lock spin_lock.
>> Pass a new allow_spin parameter where necessary to use
>> spin_trylock_irqsave().
>>
>> In kmalloc_nolock_noprof() we can now attempt alloc_from_pcs() safely,
>> for now it will always fail until we enable sheaves for kmalloc caches
>> next. Similarly in kfree_nolock() we can attempt free_to_pcs().
>>
>> Reviewed-by: Suren Baghdasaryan <surenb@...gle.com>
>> Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
>> Reviewed-by: Hao Li <hao.li@...ux.dev>
>> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
>
> I'd rather have a helper that _mayspin() or something. That way, when
> we know we need to or don't want to, we avoid extra instructions. We
> can also avoid passing true/false and complicating the interface when
> it's not necessary.
Can you elaborate a bit more how the helper looks like and it's used? I
don't follow immediately. We do have the helper for checking gfp flags to
extract mayspin, but that wouldn't avoid extra instructions so you must be
thinking of something else.
> The way it is written works as well, though.
>
> Reviewed-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Thanks!
Powered by blists - more mailing lists