Re: [PATCH] mm/slab: only require the requested size when refilling
From: Qing Wang
Date: Mon Oct 26 2026 - 05:33:17 EST
On Fri, 23 Oct 2026 at 22:22, Harry Yoo <harry@xxxxxxxxxx> wrote:
> On Fri, Oct 23, 2026 at 05:44:01PM +0800, Qing Wang wrote:
> > kmem_cache_prefill_sheaf() and kmem_cache_refill_sheaf() only guarantee
> > @size objects, but for standard capacity sheaves
> > __prefill_sheaf_pfmemalloc() uses refill_sheaf(), which actually fills
> > the sheaf up to s->sheaf_capacity.
> >
> > The call thus fails with -ENOMEM > whenever the sheaf cannot be filled
> > completely, even when @size objects were already obtained.
>
> This is extremely rare condition to happen, and so...
Yes, I went to measure the number of times of
kmem_cache_prefill_sheaf() and kmem_cache_refill_sheaf() in qemu. It's also
very low.
>
> > This leads to needless flushing of the partially
> > filled sheaf in kmem_cache_prefill_sheaf(),
>
> It doesn't make much sense to micro-optimize slab in low or out of
> memory situations.
I agree with you. Because it's so rare.
Thanks for your careful review.
--
Best regards,
Qing