Skip to contentSkip to conversation

sched/core: Simplify if logic in sched_update_worker

PATCH New Wang Jinchao 1 participant 1 message Dec 18, 2023 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/core: Simplify if logic in sched_update_worker

Reduce one if statement, remove two lines of code, and improve code clarity.

---
 kernel/sched/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
kernel/sched/core.c +4 -6
index a708d225c28e..97c7d3097947 100644
@@ -6748,12 +6748,10 @@ static inline void sched_submit_work(struct task_struct *tsk)
 
 static void sched_update_worker(struct task_struct *tsk)
 {
-	if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
-		if (tsk->flags & PF_WQ_WORKER)
-			wq_worker_running(tsk);
-		else
-			io_wq_worker_running(tsk);
-	}
+	if (tsk->flags & PF_WQ_WORKER)
+		wq_worker_running(tsk);
+	else if (tsk->flags  & PF_IO_WORKER)
+		io_wq_worker_running(tsk);
 }
 
 static __always_inline void __schedule_loop(unsigned int sched_mode)
Signature · 1 line
2.40.0