[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOIMvURE99ZRAYEj@fedora>
Date: Sun, 20 Aug 2023 20:53:17 +0800
From: Wang Jinchao <wangjinchao@...sion.com>
To: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
<linux-kernel@...r.kernel.org>
CC: <stone.xulei@...sion.com>
Subject: [PATCH] sched/core: Refactor task_flags check for worker sleeping
Simplify the conditional logic for checking worker flags
by splitting the original compound `if` statement into
separate `if` and `else if` clauses. This modification not
only retains the previous functionality but also reduces a
single `if` check, improving code clarity and potentially
enhancing performance.
Signed-off-by: Wang Jinchao <wangjinchao@...sion.com>
---
kernel/sched/core.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c52c2eba7c73..9621ee979b0b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6745,12 +6745,10 @@ static inline void sched_submit_work(struct task_struct *tsk)
* If a worker goes to sleep, notify and ask workqueue whether it
* wants to wake up a task to maintain concurrency.
*/
- if (task_flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
- if (task_flags & PF_WQ_WORKER)
- wq_worker_sleeping(tsk);
- else
- io_wq_worker_sleeping(tsk);
- }
+ if (task_flags & PF_WQ_WORKER)
+ wq_worker_sleeping(tsk);
+ else if (task_flags & PF_IO_WORKER)
+ io_wq_worker_sleeping(tsk);
/*
* spinlock and rwlock must not flush block requests. This will
--
2.40.0
Powered by blists - more mailing lists