* [PATCH] sched/core: Refactor task_flags check for worker sleeping
@ 2023-08-20 12:53 Wang Jinchao
2023-09-24 10:39 ` [tip: sched/core] sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work() tip-bot2 for Wang Jinchao
0 siblings, 1 reply; 2+ messages in thread
From: Wang Jinchao @ 2023-08-20 12:53 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Daniel Bristot de Oliveira, Valentin Schneider, linux-kernel
Cc: stone.xulei
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@xfusion.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip: sched/core] sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work()
2023-08-20 12:53 [PATCH] sched/core: Refactor task_flags check for worker sleeping Wang Jinchao
@ 2023-09-24 10:39 ` tip-bot2 for Wang Jinchao
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Wang Jinchao @ 2023-09-24 10:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Wang Jinchao, Ingo Molnar, x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 3eafe225995c67f8c179011ec2d6e4c12b32a53d
Gitweb: https://git.kernel.org/tip/3eafe225995c67f8c179011ec2d6e4c12b32a53d
Author: Wang Jinchao <wangjinchao@xfusion.com>
AuthorDate: Sun, 20 Aug 2023 20:53:17 +08:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Sun, 24 Sep 2023 12:15:06 +02:00
sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work()
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@xfusion.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/ZOIMvURE99ZRAYEj@fedora
---
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 1074934..84881a5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6711,12 +6711,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-24 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-20 12:53 [PATCH] sched/core: Refactor task_flags check for worker sleeping Wang Jinchao
2023-09-24 10:39 ` [tip: sched/core] sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work() tip-bot2 for Wang Jinchao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox