io_uring/chan: cache consumer head loads io_uring-chan
authorJens Axboe <axboe@kernel.dk>
Sat, 26 Jul 2025 03:45:25 +0000 (21:45 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 9 Aug 2025 14:38:27 +0000 (08:38 -0600)
commit45774c5b8ec273f8f79f196da575c5b8ea5bc926
treef9decbeac39179633da5eb698464f2596e0bde51
parent11e8bd03794364ebfc3e3603334896e76e6fa976
io_uring/chan: cache consumer head loads

Posting a message on the channel currently requires reading the
destination to know how far along it is. But in practice, this only
needs to be done every time the tail has caught up.

Initialize a cached_head to be that of the ring size, and use the cached
head when posting an event. If the cached entries are used up, do a
proper c->head read and update the cached_head again.

This greatly reduces the cross traffic on the posting side, by avoiding
pulling in the consumer ring head entry until it's required.

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