sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work()

JIRA: https://issues.redhat.com/browse/RHEL-25535

commit 3eafe225995c67f8c179011ec2d6e4c12b32a53d
Author: Wang Jinchao <wangjinchao@xfusion.com>
Date:   Sun Aug 20 20:53:17 2023 +0800

    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

Signed-off-by: Phil Auld <pauld@redhat.com>
This commit is contained in:
Phil Auld 2024-04-01 13:56:17 -04:00
parent 16facccecd
commit 82d55a3223
1 changed files with 4 additions and 6 deletions

View File

@ -6786,12 +6786,10 @@ void sched_submit_work(void)
* 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