Re: [PATCH RFC v2 06/20] slab: make percpu sheaves compatible with kmalloc_nolock()/kfree_nolock()
From: Vlastimil Babka
Date: Wed Jan 14 2026 - 08:57:51 EST
On 1/14/26 00:26, Alexei Starovoitov wrote:
> On Tue, Jan 13, 2026 at 10:36 AM Sebastian Andrzej Siewior
> <bigeasy@xxxxxxxxxxxxx> wrote:
>>
>> On 2026-01-12 16:17:00 [+0100], Vlastimil Babka wrote:
>> > --- a/mm/slub.c
>> > +++ b/mm/slub.c
>> > @@ -5727,6 +5742,12 @@ void *kmalloc_nolock_noprof(size_t size, gfp_t gfp_flags, int node)
>> > */
>> > return NULL;
>> >
>> > + ret = alloc_from_pcs(s, alloc_gfp, node);
>> > + if (ret)
>> > + goto success;
>>
>> I'm sorry if I am slow but this actually should actually allow
>> kmalloc_nolock() allocations on PREEMPT_RT from atomic context. I am
>> mentioning this because of the patch which removes the nmi+hardirq
>> condtion (https://lore.kernel.org/all/20260113150639.48407-1-swarajgaikwad1925@xxxxxxxxx)
>
> Right. With sheaves kmalloc_nolock() on RT will be more reliable.
Yes IIRC Hao Li pointed that out before. We'll be able to remove that
!preemptible() check that we area about to add by the patch above.
But I'm not sure we can remove (or "not put back") the "in_nmi() ||
in_hardirq()" too, because as you said it was added with different reasoning
initially?