Re: [PATCH] iomap: add allocation cache for iomap_dio

From: Christoph Hellwig

Date: Wed Jan 07 2026 - 11:18:59 EST


On Mon, Jan 05, 2026 at 05:27:54PM +0800, guzebing wrote:
> Yes, I try to use a dedicated kmem cache to allocate cache for iomap-dio
> structure. However, when system memory is sufficient, kmalloc and kmem cache
> deliver identical performance.

Thanks for benchmarking this.

> > Also any chance you could factor this into common code?
> >
> For a mempool, we first allocate with kmalloc or kmem cache and finally fall
> back to a reserved cache—this is for reliability. It’s not a great fit for
> our high‑performance scenario.
>
> Additionally, the current need for frequent allocation/free (hundreds of
> thousands to millions of times per second) may be more suitable for the bio
> or dio structures; beyond those, I’m not sure whether similar scenarios
> exist.
>
> If we were to extract a generic implementation solely for this, would it
> yield significant benefits? Do you have any good suggestions?


Factoring mean the percpu cache. But given that it's been so long that
I looked at the code all the defails of this have been paged out from
my brain. I can take another look when you resend it.