From: Hillf Danton hdanton@sina.com
mainline inclusion from mainline-5.5-rc4 commit fd1c4bc6e9b34a5e4fe7a3130a49380ef9d7037c category: feature bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27 CVE: NA ---------------------------
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 Signed-off-by: yangerkun yangerkun@huawei.com Reviewed-by: zhangyi (F) yi.zhang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- fs/io-wq.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/fs/io-wq.c b/fs/io-wq.c index 8adc2821b0cc..1b5889c89e9b 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);