提交 5a8fe193 编写于 作者: P Pavel Begunkov 提交者: Xiaoguang Wang

io-wq: don't resched if there is no work

to #28170604

commit d78298e73a3443a3c1766fa89f5370f52a4efd94 upstream

This little tweak restores the behaviour that was before the recent
io_worker_handle_work() optimisation patches. It makes the function do
cond_resched() and flush_signals() only if there is an actual work to
execute.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 2c38ddc5
...@@ -459,10 +459,12 @@ static void io_impersonate_work(struct io_worker *worker, ...@@ -459,10 +459,12 @@ static void io_impersonate_work(struct io_worker *worker,
static void io_assign_current_work(struct io_worker *worker, static void io_assign_current_work(struct io_worker *worker,
struct io_wq_work *work) struct io_wq_work *work)
{ {
/* flush pending signals before assigning new work */ if (work) {
if (signal_pending(current)) /* flush pending signals before assigning new work */
flush_signals(current); if (signal_pending(current))
cond_resched(); flush_signals(current);
cond_resched();
}
spin_lock_irq(&worker->lock); spin_lock_irq(&worker->lock);
worker->cur_work = work; worker->cur_work = work;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册