]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/fair: Use sched_energy_enabled()
authorVincent Guittot <vincent.guittot@linaro.org>
Fri, 27 Mar 2026 13:20:13 +0000 (14:20 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 3 Apr 2026 12:23:41 +0000 (14:23 +0200)
Use helper sched_energy_enabled() everywhere we want to test if EAS is
enabled instead of mixing sched_energy_enabled() and direct call to
static_branch_unlikely().

No functional change

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260327132013.2800517-1-vincent.guittot@linaro.org
kernel/sched/topology.c

index 43150591914bdf5856517a5956faa9cf3a4956f4..5847b83d9d552bd13c13c48f710c32cf9f85a2ff 100644 (file)
@@ -273,7 +273,7 @@ void rebuild_sched_domains_energy(void)
 static int sched_energy_aware_handler(const struct ctl_table *table, int write,
                void *buffer, size_t *lenp, loff_t *ppos)
 {
-       int ret, state;
+       int ret;
 
        if (write && !capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -289,8 +289,7 @@ static int sched_energy_aware_handler(const struct ctl_table *table, int write,
 
        ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
        if (!ret && write) {
-               state = static_branch_unlikely(&sched_energy_present);
-               if (state != sysctl_sched_energy_aware)
+               if (sysctl_sched_energy_aware != sched_energy_enabled())
                        rebuild_sched_domains_energy();
        }
 
@@ -388,11 +387,11 @@ static void destroy_perf_domain_rcu(struct rcu_head *rp)
 
 static void sched_energy_set(bool has_eas)
 {
-       if (!has_eas && static_branch_unlikely(&sched_energy_present)) {
+       if (!has_eas && sched_energy_enabled()) {
                if (sched_debug())
                        pr_info("%s: stopping EAS\n", __func__);
                static_branch_disable_cpuslocked(&sched_energy_present);
-       } else if (has_eas && !static_branch_unlikely(&sched_energy_present)) {
+       } else if (has_eas && !sched_energy_enabled()) {
                if (sched_debug())
                        pr_info("%s: starting EAS\n", __func__);
                static_branch_enable_cpuslocked(&sched_energy_present);