@@ -7796,7 +7796,7 @@ static inline int io_cqring_wait_schedul
struct io_wait_queue *iowq,
ktime_t *timeout)
{
- int ret;
+ int token, ret;
/* make sure we run task_work before checking for signals */
ret = io_run_task_work_sig();
@@ -7806,9 +7806,17 @@ static inline int io_cqring_wait_schedul
if (test_bit(0, &ctx->check_cq_overflow))
return 1;
+ /*
+ * 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 = 1;
if (!schedule_hrtimeout(timeout, HRTIMER_MODE_ABS))
- return -ETIME;
- return 1;
+ ret = -ETIME;
+ io_schedule_finish(token);
+ return ret;
}
/*