Commit ec17f164 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 2772d7df 8a796565
...@@ -2489,6 +2489,8 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx) ...@@ -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, static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
struct io_wait_queue *iowq) struct io_wait_queue *iowq)
{ {
int token, ret;
if (unlikely(READ_ONCE(ctx->check_cq))) if (unlikely(READ_ONCE(ctx->check_cq)))
return 1; return 1;
if (unlikely(!llist_empty(&ctx->work_llist))) if (unlikely(!llist_empty(&ctx->work_llist)))
...@@ -2499,11 +2501,20 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, ...@@ -2499,11 +2501,20 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
return -EINTR; return -EINTR;
if (unlikely(io_should_wake(iowq))) if (unlikely(io_should_wake(iowq)))
return 0; 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) if (iowq->timeout == KTIME_MAX)
schedule(); schedule();
else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS))
return -ETIME; ret = -ETIME;
return 0; io_schedule_finish(token);
return ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment