On 6/11/26 12:40 AM, Vlastimil Babka (SUSE) wrote: > Similarly to the page allocators, introduce slab-allocator specific > alloc flags that internally control allocation behavior in addition to > gfp_flags, without occupying the limited gfp flags space. > > Introduce the first flag SLAB_ALLOC_TRYLOCK that behaves similarly to > page allocator's ALLOC_TRYLOCK and will be used to reimplement > kmalloc_nolock()'s "!allow_spin" behavior. That currently relies on > gfpflags_allow_spinning() and thus the lack of both __GFP_RECLAIM flags, > importantly __GFP_KSWAPD_RECLAIM. This can give false-positive results > e.g. in early boot with a restricted gfp_allowed_mask. > > Also introduce alloc_flags_allow_spinning() to replace the usage of > gfpflags_allow_spinning(). > > Start using alloc_flags and the new check first in alloc_from_pcs() and > __pcs_replace_empty_main(). This means some slab allocations that were > falsely treated as kmalloc_nolock() due to their gfp flags will now have > higher chances of succeed, and this will further increase with followup > changes. > > Remove a WARN_ON_ONCE() from refill_objects() as it's now legitimate to > reach it from a slab allocation that's not _nolock() and yet lacks > __GFP_KSWAPD_RECLAIM for other reasons. > > Signed-off-by: Vlastimil Babka (SUSE) > --- Reviewed-by: Harry Yoo (Oracle) -- Cheers, Harry / Hyeonggon