diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2024-07-26 16:24:30 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-07-26 16:31:59 +0200 |
commit | 342b2e395d5f34c9f111a818556e617939f83a8c (patch) | |
tree | 4e09d19146f6e741dd98faeb071514a376085ff4 /io_uring/napi.h | |
parent | io_uring/msg_ring: fix uninitialized use of target_req->flags (diff) | |
download | linux-342b2e395d5f34c9f111a818556e617939f83a8c.tar.xz linux-342b2e395d5f34c9f111a818556e617939f83a8c.zip |
io_uring/napi: use ktime in busy polling
It's more natural to use ktime/ns instead of keeping around usec,
especially since we're comparing it against user provided timers,
so convert napi busy poll internal handling to ktime. It's also nicer
since the type (ktime_t vs unsigned long) now tells the unit of measure.
Keep everything as ktime, which we convert to/from micro seconds for
IORING_[UN]REGISTER_NAPI. The net/ busy polling works seems to work with
usec, however it's not real usec as shift by 10 is used to get it from
nsecs, see busy_loop_current_time(), so it's easy to get truncated nsec
back and we get back better precision.
Note, we can further improve it later by removing the truncation and
maybe convincing net/ to use ktime/ns instead.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/95e7ec8d095069a3ed5d40a4bc6f8b586698bc7e.1722003776.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/napi.h')
-rw-r--r-- | io_uring/napi.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/napi.h b/io_uring/napi.h index 6fc0393d0dbe..babbee36cd3e 100644 --- a/io_uring/napi.h +++ b/io_uring/napi.h @@ -55,7 +55,7 @@ static inline void io_napi_add(struct io_kiocb *req) struct io_ring_ctx *ctx = req->ctx; struct socket *sock; - if (!READ_ONCE(ctx->napi_busy_poll_to)) + if (!READ_ONCE(ctx->napi_busy_poll_dt)) return; sock = sock_from_file(req->file); |