diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2024-07-26 15:24:31 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-07-26 08:31:59 -0600 |
commit | 358169617602f6f71b31e5c9532a09b95a34b043 (patch) | |
tree | 1055fc3dd02e8f1aa0c676aba6c532cf0f3892d8 /io_uring/napi.c | |
parent | 342b2e395d5f34c9f111a818556e617939f83a8c (diff) |
io_uring/napi: pass ktime to io_napi_adjust_timeout
Pass the waiting time for __io_napi_adjust_timeout as ktime and get rid
of all timespec64 conversions. It's especially simpler since the caller
already have a ktime.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/4f5b8e8eed4f53a1879e031a6712b25381adc23d.1722003776.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/napi.c')
-rw-r--r-- | io_uring/napi.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/io_uring/napi.c b/io_uring/napi.c index 6bdb267e9c33..4fd6bb331e1e 100644 --- a/io_uring/napi.c +++ b/io_uring/napi.c @@ -282,20 +282,12 @@ int io_unregister_napi(struct io_ring_ctx *ctx, void __user *arg) * the NAPI timeout accordingly. */ void __io_napi_adjust_timeout(struct io_ring_ctx *ctx, struct io_wait_queue *iowq, - struct timespec64 *ts) + ktime_t to_wait) { ktime_t poll_dt = READ_ONCE(ctx->napi_busy_poll_dt); - if (ts) { - struct timespec64 poll_to_ts; - - poll_to_ts = ns_to_timespec64(ktime_to_ns(poll_dt)); - if (timespec64_compare(ts, &poll_to_ts) < 0) { - s64 poll_to_ns = timespec64_to_ns(ts); - if (poll_to_ns > 0) - poll_dt = ns_to_ktime(poll_to_ns); - } - } + if (to_wait) + poll_dt = min(poll_dt, to_wait); iowq->napi_busy_poll_dt = poll_dt; } |