io_uring/msg_ring: avoid double indirection task_work for data messages
authorJens Axboe <axboe@kernel.dk>
Fri, 24 May 2024 20:56:14 +0000 (14:56 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 5 Jun 2024 18:49:34 +0000 (12:49 -0600)
commit780f1e5e03b5fc235233d02c92eefed1b8af47e6
treee350321720c8107f9e0f4cefc98d49a9275ddc57
parenta66a97defa784e09e25a98f527404e84c61d025d
io_uring/msg_ring: avoid double indirection task_work for data messages

If IORING_SETUP_DEFER_TASKRUN is set, then we can't post CQEs remotely
to the target ring. Instead, task_work is queued for the target ring,
which is used to post the CQE. To make matters worse, once the target
CQE has been posted, task_work is then queued with the originator to
fill the completion.

This obviously adds a bunch of overhead and latency. Instead of relying
on generic kernel task_work for this, fill an overflow entry on the
target ring and flag it as such that the target ring will flush it. This
avoids both the task_work for posting the CQE, and it means that the
originator CQE can be filled inline as well.

In local testing, this reduces the latency on the sender side by 5-6x.

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