diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-07-14 19:46:54 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-07-14 19:46:54 -0700 |
commit | ec17f16432058e1406c763a81acfc1394578bc8c (patch) | |
tree | 9ba6c8a12198c0f8274ff0b5bd986974cfd948d5 /io_uring | |
parent | 2772d7df3c93f15e5b2119bd9e14724db6a21a04 (diff) | |
parent | 8a796565cec3601071cbbd27d6304e202019d014 (diff) | |
download | lwn-ec17f16432058e1406c763a81acfc1394578bc8c.tar.gz lwn-ec17f16432058e1406c763a81acfc1394578bc8c.zip |
Merge tag 'io_uring-6.5-2023-07-14' of git://git.kernel.dk/linux
Pull io_uring fix from Jens Axboe:
"Just a single tweak for the wait logic in io_uring"
* tag 'io_uring-6.5-2023-07-14' of git://git.kernel.dk/linux:
io_uring: Use io_schedule* in cqring wait
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/io_uring.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index e8096d502a7c..7505de2428e0 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2489,6 +2489,8 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx) static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, struct io_wait_queue *iowq) { + int token, ret; + if (unlikely(READ_ONCE(ctx->check_cq))) return 1; if (unlikely(!llist_empty(&ctx->work_llist))) @@ -2499,11 +2501,20 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, return -EINTR; if (unlikely(io_should_wake(iowq))) return 0; + + /* + * Use io_schedule_prepare/finish, so cpufreq can take into account + * that the task is waiting for IO - turns out to be important for low + * QD IO. + */ + token = io_schedule_prepare(); + ret = 0; if (iowq->timeout == KTIME_MAX) schedule(); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) - return -ETIME; - return 0; + ret = -ETIME; + io_schedule_finish(token); + return ret; } /* |