Skip to content

Commit ec17f16

Browse files
committed
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
2 parents 2772d7d + 8a79656 commit ec17f16

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

io_uring/io_uring.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,8 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx)
24892489
static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
24902490
struct io_wait_queue *iowq)
24912491
{
2492+
int token, ret;
2493+
24922494
if (unlikely(READ_ONCE(ctx->check_cq)))
24932495
return 1;
24942496
if (unlikely(!llist_empty(&ctx->work_llist)))
@@ -2499,11 +2501,20 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
24992501
return -EINTR;
25002502
if (unlikely(io_should_wake(iowq)))
25012503
return 0;
2504+
2505+
/*
2506+
* Use io_schedule_prepare/finish, so cpufreq can take into account
2507+
* that the task is waiting for IO - turns out to be important for low
2508+
* QD IO.
2509+
*/
2510+
token = io_schedule_prepare();
2511+
ret = 0;
25022512
if (iowq->timeout == KTIME_MAX)
25032513
schedule();
25042514
else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS))
2505-
return -ETIME;
2506-
return 0;
2515+
ret = -ETIME;
2516+
io_schedule_finish(token);
2517+
return ret;
25072518
}
25082519

25092520
/*

0 commit comments

Comments
 (0)