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>
Wed, 27 Aug 2025 18:23:25 +0000 (12:23 -0600)
commitafb5c4a2227465c1e9f5ca315c25e4f9c9217f94
tree04f2de74bc7c4f077cf1f6382a2415665f5dbae2
parent2f6db2c39efbf64e87899f2895fe7618ec763205
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