Re: [PATCH] iomap: add allocation cache for iomap_dio
From: Christoph Hellwig
Date: Fri Nov 21 2025 - 05:22:13 EST
On Fri, Nov 21, 2025 at 05:00:52PM +0800, guzebing wrote:
> From: guzebing <guzebing@xxxxxxxxxxxxx>
>
> As implemented by the bio structure, we do the same thing on the
> iomap-dio structure. Add a per-cpu cache for iomap_dio allocations,
> enabling us to quickly recycle them instead of going through the slab
> allocator.
>
> By making such changes, we can reduce memory allocation on the direct
> IO path, so that direct IO will not block due to insufficient system
> memory. In addition, for direct IO, the read performance of io_uring
> is improved by about 2.6%.
Have you checked how much of that you'd get by using a dedicated
slab cache that should also do per-cpu allocations? Note that even
if we had a dedicated per-cpu cache we'd probably still want that.
Also any chance you could factor this into common code?