Re: [PATCH 2/3] mm: support fallible mempool_alloc_bulk()

From: Christoph Hellwig

Date: Wed Aug 12 2026 - 09:42:48 EST


On Tue, Aug 11, 2026 at 02:03:38PM -0700, Eric Biggers wrote:
> On Tue, Aug 11, 2026 at 01:13:37PM -0700, Christoph Hellwig wrote:
> > What is actually efficient is do skip the mempool entirely from the
> > original submission context and do a non-mempool GFP_NOIO allocation,
> > and only in the extremely unlikely case that this fails fall back to
> > the rescruer thread.
>
> It definitely is *not* more efficient to fall back to a kworker for a
> small task (removing elements from a mempool that has them available)
> that could just be done synchronously.

That is not the point. The point is that mempool_alloc_bulk frequently
fails to allocate all pages, and just filling that with a plain
alloc_pages is way faster than calling into the mempool code in any
form. The case where we actually need the mempool entries is extremely
rare.