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:
parent
1f424e8bd1
commit
fd1c4bc6e9
|
@ -429,6 +429,8 @@ static void io_worker_handle_work(struct io_worker *worker)
|
||||||
if (signal_pending(current))
|
if (signal_pending(current))
|
||||||
flush_signals(current);
|
flush_signals(current);
|
||||||
|
|
||||||
|
cond_resched();
|
||||||
|
|
||||||
spin_lock_irq(&worker->lock);
|
spin_lock_irq(&worker->lock);
|
||||||
worker->cur_work = work;
|
worker->cur_work = work;
|
||||||
spin_unlock_irq(&worker->lock);
|
spin_unlock_irq(&worker->lock);
|
||||||
|
|
Loading…
Reference in New Issue