Re: [PATCH v3] mm/slub: prevent pfmemalloc objects from entering the barn

From: Harry Yoo

Date: Tue Jul 21 2026 - 11:59:29 EST




On 7/21/26 6:04 PM, hu.shengming@xxxxxxxxxx wrote:
> Vlastimil wrote:
>> On 7/21/26 09:34, Vlastimil Babka (SUSE) wrote:
>>> On 7/21/26 02:45, hu.shengming@xxxxxxxxxx wrote:
>>>> From: Shengming Hu <hu.shengming@xxxxxxxxxx>
>>>>
>>>> kmem_cache_return_sheaf() may refill a partially consumed sheaf before
>>>> placing it in the barn. Without an explicit restriction, this refill may
>>>> draw objects from pfmemalloc slabs and consume emergency reserves.
>>>>
>>>> Add __GFP_NOMEMALLOC so that returned sheaves are refilled only from
>>>> non-pfmemalloc slabs. Also add __GFP_NOWARN, as suggested by Hao Li,
>>>> because this refill is a best-effort attempt and failure is acceptable..
>>>> If the refill fails, flush and free the sheaf instead.
>>>>
>>>> Fixes: 3c1ea5c5019f ("slab: sheaf prefilling for guaranteed allocations")
>>>
>>> Wonder if 1ce20c28eafd ("slab: handle pfmemalloc slabs properly with
>>> sheaves") is a better match. Until that commit we just didn't care, and it
>>> seems like this is a case that commit missed?
>
> Agreed, 1ce20c28eafd is a better match. Thanks for catching this.

Agreed, thanks!

--
Cheers,
Harry / Hyeonggon

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature