io_uring: recycle apoll_poll entries
authorJens Axboe <axboe@kernel.dk>
Tue, 15 Mar 2022 16:54:08 +0000 (10:54 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Mar 2022 16:54:08 +0000 (10:54 -0600)
commit4d9237e32c5db4f07f749a7ff1dd9b366bf3600e
treed6247366ed90372af4ffb69ee8827cfd7052a411
parentf3b6a41eb2bbdf545a42e54d637c34f4b1fdf5b9
io_uring: recycle apoll_poll entries

Particularly for networked workloads, io_uring intensively uses its
poll based backend to get a notification when data/space is available.
Profiling workloads, we see 3-4% of alloc+free that is directly attributed
to just the apoll allocation and free (and the rest being skb alloc+free).

For the fast path, we have ctx->uring_lock held already for both issue
and the inline completions, and we can utilize that to avoid any extra
locking needed to have a basic recycling cache for the apoll entries on
both the alloc and free side.

Double poll still requires an allocation. But those are rare and not
a fast path item.

With the simple cache in place, we see a 3-4% reduction in overhead for
the workload.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c