Re: [PATCH] sched/topology: remove sysctl_sched_energy_aware depending on the architecture

From: Chen Yu
Date: Wed Aug 30 2023 - 15:23:39 EST


Hi Shrikanth,

On 2023-08-29 at 12:20:40 +0530, Shrikanth Hegde wrote:
> Currently sysctl_sched_energy_aware doesn't alter the said behaviour on
> some of the architectures. IIUC its meant to either force rebuild the
> perf domains or cleanup the perf domains by echoing 1 or 0 respectively.
>
> perf domains are not built when there is SMT, or when there is no
> Asymmetric CPU topologies or when there is no frequency invariance.
> Since such cases EAS is not set and perf domains are not built. By
> changing the values of sysctl_sched_energy_aware, its not possible to
> force build the perf domains. Hence remove this sysctl on such platforms
> that dont support it at boot. Some of the settings can be changed later
> such as smt_active by offlining the CPU's, In those cases
> build_perf_domains returns true, in that case re-enable the sysctl.
>
> Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxxxxxxx>
>

[snip...]

> @@ -380,15 +400,11 @@ static bool build_perf_domains(const struct cpumask *cpu_map)
> struct cpufreq_policy *policy;
> struct cpufreq_governor *gov;
>
> - if (!sysctl_sched_energy_aware)
> - goto free;
> -

I tried to ramp up the EAS and maybe I overlooked it, why do we remove above
check? If the system boots with EAS enabled and sysctl_sched_energy_aware
set to 1, then the user wants to disable EAS then changing sysctl_sched_energy_aware
to 0. Without above check, how could the perf domain be freed?

thanks,
Chenyu