Re: [PATCH v2] mm/slub: prevent pfmemalloc objects from entering the barn
From: hu.shengming
Date: Mon Jul 20 2026 - 20:33:26 EST
Harry wrote:
> On 7/20/26 10:11 PM, 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
> > normal memory. Also add __GFP_NOWARN, as suggested by Hao Li, because this
>
> normal memory -> non-pfmemalloc slabs?
>
Thanks, “non-pfmemalloc slabs” is indeed more precise. I’ll update it.
> > refill is a best-effort attempt and failure is acceptable. If the refill
> > fails, flush and free the sheaf instead.
> >
> > Signed-off-by: Shengming Hu <hu.shengming@xxxxxxxxxx>
> > ---
>
> Overall looks good to me.
>
> Probably worth adding Fixes: and Cc: stable to make processes' life
> slightly easier under low memory situations?
>
> Given that the API is not widely used yet I'm not sure how bad it would
> be in practice, but the fix is quite simple.
>
I’ll also add the Fixes: tag and Cc: stable in v3.
--
With Best Regards,
Shengming