io-wq: add cond_resched() to worker thread

Reschedule the current IO worker to cut the risk that it is becoming
a cpu hog.

Signed-off-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Hillf Danton 2019-12-24 09:14:29 -07:00 committed by Jens Axboe
parent 1f424e8bd1
commit fd1c4bc6e9
1 changed files with 2 additions and 0 deletions

View File

@ -429,6 +429,8 @@ static void io_worker_handle_work(struct io_worker *worker)
if (signal_pending(current))
flush_signals(current);
cond_resched();
spin_lock_irq(&worker->lock);
worker->cur_work = work;
spin_unlock_irq(&worker->lock);