io_uring/alloc_cache: switch to array based caching
authorJens Axboe <axboe@kernel.dk>
Wed, 20 Mar 2024 21:19:44 +0000 (15:19 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 15 Apr 2024 14:10:25 +0000 (08:10 -0600)
commit414d0f45c316221acbf066658afdbae5b354a5cc
tree9c872a002b5fa5119cd91d706045ebb915c338d9
parente10677a8f6980dbae2e866b8320d90bae07e87ee
io_uring/alloc_cache: switch to array based caching

Currently lists are being used to manage this, but best practice is
usually to have these in an array instead as that it cheaper to manage.

Outside of that detail, games are also played with KASAN as the list
is inside the cached entry itself.

Finally, all users of this need a struct io_cache_entry embedded in
their struct, which is union'ized with something else in there that
isn't used across the free -> realloc cycle.

Get rid of all of that, and simply have it be an array. This will not
change the memory used, as we're just trading an 8-byte member entry
for the per-elem array size.

This reduces the overhead of the recycled allocations, and it reduces
the amount of code code needed to support recycling to about half of
what it currently is.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
15 files changed:
include/linux/io_uring_types.h
io_uring/alloc_cache.h
io_uring/futex.c
io_uring/futex.h
io_uring/io_uring.c
io_uring/net.c
io_uring/net.h
io_uring/poll.c
io_uring/poll.h
io_uring/rsrc.c
io_uring/rsrc.h
io_uring/rw.c
io_uring/rw.h
io_uring/uring_cmd.c
io_uring/uring_cmd.h