Skip to content

Commit b945efc

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
sched: Remove pointless preemption disable in sched_submit_work()
Neither wq_worker_sleeping() nor io_wq_worker_sleeping() require to be invoked with preemption disabled: - The worker flag checks operations only need to be serialized against the worker thread itself. - The accounting and worker pool operations are serialized with locks. which means that disabling preemption has neither a reason nor a value. Remove it and update the stale comment. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Lai Jiangshan <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Link: https://lkml.kernel.org/r/8735pnafj7.ffs@tglx
1 parent 670721c commit b945efc

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

kernel/sched/core.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6251,20 +6251,14 @@ static inline void sched_submit_work(struct task_struct *tsk)
62516251

62526252
task_flags = tsk->flags;
62536253
/*
6254-
* If a worker went to sleep, notify and ask workqueue whether
6255-
* it wants to wake up a task to maintain concurrency.
6256-
* As this function is called inside the schedule() context,
6257-
* we disable preemption to avoid it calling schedule() again
6258-
* in the possible wakeup of a kworker and because wq_worker_sleeping()
6259-
* requires it.
6254+
* If a worker goes to sleep, notify and ask workqueue whether it
6255+
* wants to wake up a task to maintain concurrency.
62606256
*/
62616257
if (task_flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
6262-
preempt_disable();
62636258
if (task_flags & PF_WQ_WORKER)
62646259
wq_worker_sleeping(tsk);
62656260
else
62666261
io_wq_worker_sleeping(tsk);
6267-
preempt_enable_no_resched();
62686262
}
62696263

62706264
if (tsk_is_pi_blocked(tsk))

0 commit comments

Comments
 (0)