io_uring: cache req->apoll->events in req->cflags
authorJens Axboe <axboe@kernel.dk>
Wed, 16 Mar 2022 22:55:05 +0000 (16:55 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Mar 2022 22:55:05 +0000 (16:55 -0600)
commit81459350d581e958ee9c6e76031f77333881c23c
tree431fc1a80f9c1230735df6ecd8e8371300c05e52
parent521d61fc760aebdbf8938347a40c9538c0a70034
io_uring: cache req->apoll->events in req->cflags

When we arm poll on behalf of a different type of request, like a network
receive, then we allocate req->apoll as our poll entry. Running network
workloads shows io_poll_check_events() as the most expensive part of
io_uring, and it's all due to having to pull in req->apoll instead of
just the request which we have hot already.

Cache poll->events in req->cflags, which isn't used until the request
completes anyway. This isn't strictly needed for regular poll, where
req->poll.events is used and thus already hot, but for the sake of
unification we do it all around.

This saves 3-4% of overhead in certain request workloads.

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