The cond_resched() call was added in commit f341861fb0b7 ("task_work: add a scheduling point in task_work_run()") because of softlockups when processes with a large number of open sockets would exit. Given the always-on PREEMPTION, we should be able to remove it without much concern. However, task_work_run() does get called from some "interesting" places: one of them being the exit_to_user_loop() itself. That means that if TIF_NEED_RESCHED (or TIF_NEED_RESCHED_LAZY) were to be set once we were in a potentially long running task_work_run() all, then we would ignore the need-resched flags and there would be no call to schedule(). However, in that case, the next timer tick should cause rescheduling in irqentry_exit_cond_resched(), since then the TIF_NEED_RESCHED flag (even if the original flag were TIF_NEED_RESCHED_LAZY the tick would upgrade that.) Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx> --- kernel/task_work.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/task_work.c b/kernel/task_work.c index 95a7e1b7f1da..6a891465c8e1 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c @@ -179,7 +179,6 @@ void task_work_run(void) next = work->next; work->func(work); work = next; - cond_resched(); } while (work); } } -- 2.31.1