bio: add allocation cache abstraction
authorJens Axboe <axboe@kernel.dk>
Mon, 8 Mar 2021 18:37:47 +0000 (11:37 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 Aug 2021 21:14:15 +0000 (15:14 -0600)
commit0a87b41f906c681ba0cb23d2733dbaf0316e0e9b
tree2046dbb6d1262be0aa2116e2c0d4d056d3a36ce1
parent41cc63a7b6ea8c1df10cbe5e7336927ae46eb52e
bio: add allocation cache abstraction

Add a set of helpers that can encapsulate bio allocations, reusing them
as needed. Caller must provide the necessary locking, if any is needed.
The primary intended use case is polled IO from io_uring, which will not
need any external locking.

Very simple - keeps a count of bio's in the cache, and maintains a max
of 512 with a slack of 64. If we get above max + slack, we drop slack
number of bio's.

The cache is intended to be per-task, and the user will need to supply
the storage for it. As io_uring will be the only user right now, provide
a hook that returns the cache there. Stub it out as NULL initially.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
include/linux/bio.h
include/linux/io_uring.h