]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched: Unify SMT active check via sched_smt_active()
authorShrikanth Hegde <sshegde@linux.ibm.com>
Fri, 15 May 2026 17:24:56 +0000 (22:54 +0530)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 19 May 2026 10:17:37 +0000 (12:17 +0200)
There is a use of sched_smt_active() and explicit use of sched_smt_present.
Remove the explicit usage for better code maintenance and readability.

Note that this differs slightly for update_idle_core. It used to call
static_branch_unlikely earlier and now it will call static_branch_likely.

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Link: https://patch.msgid.link/20260515172456.542799-5-sshegde@linux.ibm.com
kernel/sched/core_sched.c
kernel/sched/fair.c
kernel/sched/sched.h

index 73b6b24269119b63d831a08ff09a51eecc3a7f7a..43e0bde3038e9fde6a5286775909bd0a0935f8b3 100644 (file)
@@ -136,7 +136,7 @@ int sched_core_share_pid(unsigned int cmd, pid_t pid, enum pid_type type,
        struct pid *grp;
        int err = 0;
 
-       if (!static_branch_likely(&sched_smt_present))
+       if (!sched_smt_active())
                return -ENODEV;
 
        BUILD_BUG_ON(PR_SCHED_CORE_SCOPE_THREAD != PIDTYPE_PID);
index 14bd31b17c716769e3df082ee7500898491f04c3..bcaadddf862408b27cc52d5095fea86d278ce33a 100644 (file)
@@ -2247,7 +2247,7 @@ numa_type numa_classify(unsigned int imbalance_pct,
 static inline bool test_idle_cores(int cpu);
 static inline int numa_idle_core(int idle_core, int cpu)
 {
-       if (!static_branch_likely(&sched_smt_present) ||
+       if (!sched_smt_active() ||
            idle_core >= 0 || !test_idle_cores(cpu))
                return idle_core;
 
index e476623a0c2af7ed67123511eafdbfb85ae7913f..ffe77b2b6296ce1d9cbc11034a7ec4a388b1e78f 100644 (file)
@@ -1671,7 +1671,7 @@ extern void __update_idle_core(struct rq *rq);
 
 static inline void update_idle_core(struct rq *rq)
 {
-       if (static_branch_unlikely(&sched_smt_present))
+       if (sched_smt_active())
                __update_idle_core(rq);
 }