mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-21 20:22:13 +08:00
io_uring: don't save/restore iowait state
This kind of state is per-syscall, and since we're doing the waiting off
entering the io_uring_enter(2) syscall, there's no way that iowait can
already be set for this case. Simplify it by setting it if we need to,
and always clearing it to 0 when done.
Fixes: 7b72d661f1
("io_uring: gate iowait schedule on having pending requests")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
045395d86a
commit
6f0974eccb
@ -2539,7 +2539,7 @@ static bool current_pending_io(void)
|
|||||||
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 io_wait, ret;
|
int ret;
|
||||||
|
|
||||||
if (unlikely(READ_ONCE(ctx->check_cq)))
|
if (unlikely(READ_ONCE(ctx->check_cq)))
|
||||||
return 1;
|
return 1;
|
||||||
@ -2557,7 +2557,6 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
|
|||||||
* can take into account that the task is waiting for IO - turns out
|
* can take into account that the task is waiting for IO - turns out
|
||||||
* to be important for low QD IO.
|
* to be important for low QD IO.
|
||||||
*/
|
*/
|
||||||
io_wait = current->in_iowait;
|
|
||||||
if (current_pending_io())
|
if (current_pending_io())
|
||||||
current->in_iowait = 1;
|
current->in_iowait = 1;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -2565,7 +2564,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
|
|||||||
schedule();
|
schedule();
|
||||||
else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS))
|
else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS))
|
||||||
ret = -ETIME;
|
ret = -ETIME;
|
||||||
current->in_iowait = io_wait;
|
current->in_iowait = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user