sched/core: Simplify if logic in sched_update_worker

Message ID 202312182023+0800-wangjinchao@xfusion.com
State New
Headers
Series sched/core: Simplify if logic in sched_update_worker |

Commit Message

Wang Jinchao Dec. 18, 2023, 12:24 p.m. UTC
  Reduce one if statement, remove two lines of code,
and improve code clarity.

Signed-off-by: Wang Jinchao <wangjinchao@xfusion.com>
---
 kernel/sched/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
  

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a708d225c28e..97c7d3097947 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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)