io_uring: switch to per-cpu task_work for-5.20/io_uring-tw
authorJens Axboe <axboe@kernel.dk>
Thu, 16 Jun 2022 17:20:12 +0000 (11:20 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 17 Jun 2022 14:26:05 +0000 (08:26 -0600)
commit9adb5df42261fb7c7058755d288b3bc794769a14
treecadc11db2225f7ea1d3fa678ac16e6dc8b19e384
parent389bdfc03121c9a075da31d090d7249d032ba508
io_uring: switch to per-cpu task_work

We see contention on the task_work locking and list management for
networked workloads, where it's not uncommon to have task_work arriving
from multiple CPUs in the system.

The task_work handling ends up with the original task, but to save on
the overhead of repeatedly re-adding that (which is an expensive
cmpxchg), it's wrapped in a per-tctx task_list which belongs to the
original submitter. Having many networked requests inflight can mean
that there's a lot of addition activity on the structure.

Move from a single per-tctx target list to a per-cpu one instead. This
allows multiple completers to add task_work without having to
synchronize on the same lock and list.

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