io-wq: add cond_resched() to worker thread
authorHillf Danton <hdanton@sina.com>
Tue, 24 Dec 2019 16:14:29 +0000 (09:14 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 24 Dec 2019 16:14:29 +0000 (09:14 -0700)
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>
fs/io-wq.c

index a1c85458f021ab94da9681632fac20f37b4ec529..541c8a3e0bbb5154468dd84164fbb0319d8e8b91 100644 (file)
@@ -429,6 +429,8 @@ next:
                if (signal_pending(current))
                        flush_signals(current);
 
+               cond_resched();
+
                spin_lock_irq(&worker->lock);
                worker->cur_work = work;
                spin_unlock_irq(&worker->lock);