OSDN Git Service

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 a1c8545..541c8a3 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);