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

From: Hao Li

Date: Tue Jul 21 2026 - 02:11:34 EST


On Tue, Jul 21, 2026 at 08:45:22AM +0800, 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")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Shengming Hu <hu.shengming@xxxxxxxxxx>

LGTM
Reviewed-by: Hao Li <hao.li@xxxxxxxxx>

--
Thanks,
Hao