diff options
author | 2023-08-20 20:53:17 +0800 | |
---|---|---|
committer | 2023-09-24 12:15:06 +0200 | |
commit | 3eafe225995c67f8c179011ec2d6e4c12b32a53d (patch) | |
tree | 0d3925bb47c4a01be52330ac0648e9aece2c9c5b /kernel/sched/core.c | |
parent | sched/fair: Fix warning in bandwidth distribution (diff) | |
download | linux-3eafe225995c67f8c179011ec2d6e4c12b32a53d.tar.gz linux-3eafe225995c67f8c179011ec2d6e4c12b32a53d.tar.bz2 linux-3eafe225995c67f8c179011ec2d6e4c12b32a53d.zip |
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
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 107493469b4e..84881a582847 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 |