[PATCH v6 3/4] sched/topology: Remove max_cpu_capacity from root_domain

Qais Yousef posted 4 patches 1 year, 11 months ago
There is a newer version of this series
[PATCH v6 3/4] sched/topology: Remove max_cpu_capacity from root_domain
Posted by Qais Yousef 1 year, 11 months ago
The value is no longer used as we now keep track of max_allowed_capacity
for each task instead.

Signed-off-by: Qais Yousef <qyousef@layalina.io>
---
 kernel/sched/sched.h    |  2 --
 kernel/sched/topology.c | 13 ++-----------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index e85976bd2bab..bc9e598d6f62 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -917,8 +917,6 @@ struct root_domain {
 	cpumask_var_t		rto_mask;
 	struct cpupri		cpupri;
 
-	unsigned long		max_cpu_capacity;
-
 	/*
 	 * NULL-terminated list of performance domains intersecting with the
 	 * CPUs of the rd. Protected by RCU.
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 1505677e4247..a57c006d2923 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2513,16 +2513,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
 	/* Attach the domains */
 	rcu_read_lock();
 	for_each_cpu(i, cpu_map) {
-		unsigned long capacity;
-
 		rq = cpu_rq(i);
 		sd = *per_cpu_ptr(d.sd, i);
 
-		capacity = arch_scale_cpu_capacity(i);
-		/* Use READ_ONCE()/WRITE_ONCE() to avoid load/store tearing: */
-		if (capacity > READ_ONCE(d.rd->max_cpu_capacity))
-			WRITE_ONCE(d.rd->max_cpu_capacity, capacity);
-
 		cpu_attach_domain(sd, d.rd, i);
 
 		if (lowest_flag_domain(i, SD_CLUSTER))
@@ -2536,10 +2529,8 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
 	if (has_cluster)
 		static_branch_inc_cpuslocked(&sched_cluster_active);
 
-	if (rq && sched_debug_verbose) {
-		pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",
-			cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
-	}
+	if (rq && sched_debug_verbose)
+		pr_info("root domain span: %*pbl\n", cpumask_pr_args(cpu_map));
 
 	ret = 0;
 error:
-- 
2.34.1
Re: [PATCH v6 3/4] sched/topology: Remove max_cpu_capacity from root_domain
Posted by Vincent Guittot 1 year, 11 months ago
On Tue, 20 Feb 2024 at 23:56, Qais Yousef <qyousef@layalina.io> wrote:
>
> The value is no longer used as we now keep track of max_allowed_capacity
> for each task instead.
>
> Signed-off-by: Qais Yousef <qyousef@layalina.io>

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  kernel/sched/sched.h    |  2 --
>  kernel/sched/topology.c | 13 ++-----------
>  2 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index e85976bd2bab..bc9e598d6f62 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -917,8 +917,6 @@ struct root_domain {
>         cpumask_var_t           rto_mask;
>         struct cpupri           cpupri;
>
> -       unsigned long           max_cpu_capacity;
> -
>         /*
>          * NULL-terminated list of performance domains intersecting with the
>          * CPUs of the rd. Protected by RCU.
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 1505677e4247..a57c006d2923 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2513,16 +2513,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>         /* Attach the domains */
>         rcu_read_lock();
>         for_each_cpu(i, cpu_map) {
> -               unsigned long capacity;
> -
>                 rq = cpu_rq(i);
>                 sd = *per_cpu_ptr(d.sd, i);
>
> -               capacity = arch_scale_cpu_capacity(i);
> -               /* Use READ_ONCE()/WRITE_ONCE() to avoid load/store tearing: */
> -               if (capacity > READ_ONCE(d.rd->max_cpu_capacity))
> -                       WRITE_ONCE(d.rd->max_cpu_capacity, capacity);
> -
>                 cpu_attach_domain(sd, d.rd, i);
>
>                 if (lowest_flag_domain(i, SD_CLUSTER))
> @@ -2536,10 +2529,8 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>         if (has_cluster)
>                 static_branch_inc_cpuslocked(&sched_cluster_active);
>
> -       if (rq && sched_debug_verbose) {
> -               pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",
> -                       cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
> -       }
> +       if (rq && sched_debug_verbose)
> +               pr_info("root domain span: %*pbl\n", cpumask_pr_args(cpu_map));
>
>         ret = 0;
>  error:
> --
> 2.34.1
>