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

Vlastimil Babka
2025-11-06T15:09:15Z

On 11/6/25 16:00, Christoph Hellwig wrote:
> 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.

Fine, as long as we don't break some existing users that became dependent on
it in some way.