Re: [PATCH] sched: flush plug in schedule_preempt_disabled() to prevent deadlock
From: Peter Zijlstra
Date: Tue May 12 2026 - 12:50:14 EST
On Tue, May 12, 2026 at 11:45:14PM +0800, Ming Lei wrote:
> > io_schedule()
> > token = io_schedule_prepare()
> > blk_flush_plug(current->plug, true);
> > schedule()
> > if (!task_is_running(tsk))
> > sched_submit_work()
> > blk_flush_plug(tsk->plug, true);
> >
> > Why isn't the one in sched_submit_work() sufficient? This thing either
> > needs a comment justifying its existence, or get removed.
> If io_schedule_prepare() can be called in every iowait context, looks
> blk_flush_plug() from sched_submit_work() may be removed.
No, the other way around. I don't see the point of having the one in
io_schedule_prepare(), since we'll hit the one in sched_submit_work().