Re: [PATCH] slab: Fix using this_cpu_ptr() in preemptible context

Vlastimil Babka
2025-10-03T06:52:35Z

On 10/2/25 11:00, Harry Yoo wrote:
> On Thu, Oct 02, 2025 at 10:14:55AM +0200, Vlastimil Babka wrote:
>> However...
>> > Is this PREEMPT_RT ?
>> >
>> >> > __alloc_tagging_slab_alloc_hook+0xa0/0x300
>> >> > __kmalloc_cache_noprof+0x1c4/0x5c0
>> >> > __set_page_owner+0x10d/0x1c0
>>
>> This is the part that puzzles me, where do we call kmalloc from
>> __set_page_owner()?
>
> It's
>
> __set_page_owner()
> -> inc_stack_record_count()
> -> add_stack_record_to_list()
> -> kmalloc().

Thanks, missed that.

>> And in a way that it loses the GFP_KERNEL passed all the
>> way? I don't even see a lib/stackdepot function here.
>
> Oh wait, we clear __GFP_RECLAIM on the first attempt to allocate
> high-order slabs. so gfpflags_allow_spinning() returns false.

Ah right! Dang, that's suboptimal that we intend to do an opportunistic
attempt, but limit the allocations of supplementary objects this way. But I
don't see how to avoid this without inventing new gfp flags.