Skip to content

Commit

Permalink
io-wq: add cond_resched() to worker thread
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hillf Danton authored and Jens Axboe committed Dec 24, 2019
1 parent 1f424e8 commit fd1c4bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/io-wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fd1c4bc

Please sign in to comment.