From 6c0002d3a2730da9dfbca0d035ddc785de38e6d2 Mon Sep 17 00:00:00 2001 From: Hillf Danton Date: Tue, 24 Dec 2019 09:14:29 -0700 Subject: [PATCH] io-wq: add cond_resched() to worker thread to #26323578 commit fd1c4bc6e9b34a5e4fe7a3130a49380ef9d7037c upstream. Reschedule the current IO worker to cut the risk that it is becoming a cpu hog. Signed-off-by: Hillf Danton Signed-off-by: Jens Axboe Signed-off-by: Joseph Qi Acked-by: Xiaoguang Wang --- fs/io-wq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/io-wq.c b/fs/io-wq.c index 6b41df72c93b..807ccdf46400 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -430,6 +430,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); -- GitLab