Re: [PATCH 3/9] mempool: add mempool_{alloc,free}_bulk

Christoph Hellwig
2025-11-06T15:00:54Z

On Thu, Nov 06, 2025 at 03:57:13PM +0100, Vlastimil Babka wrote:
> > I think the only reason mempool_alloc even allows !__GFP_DIRECT_RECLAIM
> > is to avoid special casing that in callers that have a non-constant
> > gfp mask. So maybe the best thing would be to never actually go to
> > the pool for them and just give up if alloc_fn fails?
>
> Yeah, but I guess we could keep trying the pool for the single allocation
> case as that's simple enough, just not for the bulk.

Doing that will be quite a bit more complicated I think. And given
that the !__GFP_DIRECT_RECLAIM handlers must be able to handle failure
I'm also not sure that using the pool is all that useful.