All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: peterz@infradead.org, mingo@redhat.com,
	vincent.guittot@linaro.org, vdonnefort@gmail.com
Cc: linux-kernel@vger.kernel.org, morten.rasmussen@arm.com,
	chris.redpath@arm.com, qperret@google.com, tao.zhou@linux.dev
Subject: Re: [PATCH v8 6/7] sched/fair: Remove task_util from effective utilization in feec()
Date: Thu, 5 May 2022 20:41:45 +0200	[thread overview]
Message-ID: <cd29f36a-9063-dae6-4526-85494c221bd2@arm.com> (raw)
In-Reply-To: <20220429141148.181816-7-vincent.donnefort@arm.com>

+ vdonnefort@gmail.com
- vincent.donnefort@arm.com

On 29/04/2022 16:11, Vincent Donnefort wrote:

[...]

> Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>

[...]

> -static long
> -compute_energy(struct task_struct *p, int dst_cpu, struct cpumask *cpus,
> -	       struct perf_domain *pd)
> +static inline void eenv_task_busy_time(struct energy_env *eenv,
> +				       struct task_struct *p, int prev_cpu)
>  {
> -	unsigned long max_util = 0, sum_util = 0, cpu_cap;
> +	unsigned long max_cap = arch_scale_cpu_capacity(prev_cpu);
> +	unsigned long irq = cpu_util_irq(cpu_rq(prev_cpu));
> +
> +	if (unlikely(irq >= max_cap)) {
> +		eenv->task_busy_time = max_cap;
> +		return;
> +	}
> +
> +	eenv->task_busy_time =
> +		scale_irq_capacity(task_util_est(p), irq, max_cap);

Nit-pick:

Maybe a little bit lighter:

 static inline void eenv_task_busy_time(struct energy_env *eenv,
                                       struct task_struct *p, int prev_cpu)
 {
-       unsigned long max_cap = arch_scale_cpu_capacity(prev_cpu);
+       unsigned long busy_time, max_cap = arch_scale_cpu_capacity(prev_cpu);
        unsigned long irq = cpu_util_irq(cpu_rq(prev_cpu));
 
-       if (unlikely(irq >= max_cap)) {
-               eenv->task_busy_time = max_cap;
-               return;
-       }
+       if (unlikely(irq >= max_cap))
+               busy_time = max_cap;
+       else
+               busy_time = scale_irq_capacity(task_util_est(p), irq, max_cap);
 
-       eenv->task_busy_time =
-               scale_irq_capacity(task_util_est(p), irq, max_cap);
+       eenv->task_busy_time = busy_time;
 }

[...]

> +static inline unsigned long
> +compute_energy(struct energy_env *eenv, struct perf_domain *pd,
> +	       struct cpumask *pd_cpus, struct task_struct *p, int dst_cpu)
> +{
> +	unsigned long max_util = eenv_pd_max_util(eenv, pd_cpus, p, dst_cpu);
> +	unsigned long busy_time = eenv->pd_busy_time;
> +
> +	if (dst_cpu >= 0)
> +		busy_time = min(eenv->pd_cap,
> +				eenv->pd_busy_time + eenv->task_busy_time);

Nit-pick:

        if (dst_cpu >= 0)
-               busy_time = min(eenv->pd_cap,
-                               eenv->pd_busy_time + eenv->task_busy_time);
+               busy_time = min(eenv->pd_cap, busy_time + eenv->task_busy_time);

[..]

> @@ -6905,12 +6976,14 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
>  			continue;
>  
>  		/* Compute the 'base' energy of the pd, without @p */
> -		base_energy_pd = compute_energy(p, -1, cpus, pd);
> +		eenv_pd_busy_time(&eenv, cpus, p);

Nit-pick:

Move comment /* Compute the 'base' energy of the pd, without @p */ here
since eenv->pd_busy_time is also used to calculate prev_delta and cur_delta. 


> +		base_energy_pd = compute_energy(&eenv, pd, cpus, p, -1);>  		base_energy += base_energy_pd;

[...]

  reply	other threads:[~2022-05-05 18:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 14:11 [PATCH v8 0/7] feec() energy margin removal Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 1/7] sched/fair: Provide u64 read for 32-bits arch helper Vincent Donnefort
2022-05-05 18:25   ` Dietmar Eggemann
2022-05-05 18:44     ` Dietmar Eggemann
2022-04-29 14:11 ` [PATCH v8 2/7] sched/fair: Decay task PELT values during wakeup migration Vincent Donnefort
2022-04-29 17:09   ` Tao Zhou
2022-05-06 13:58     ` Vincent Guittot
2022-05-05 18:41   ` Dietmar Eggemann
2022-04-29 14:11 ` [PATCH v8 3/7] sched, drivers: Remove max param from effective_cpu_util()/sched_cpu_util() Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 4/7] sched/fair: Rename select_idle_mask to select_rq_mask Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 5/7] sched/fair: Use the same cpumask per-PD throughout find_energy_efficient_cpu() Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 6/7] sched/fair: Remove task_util from effective utilization in feec() Vincent Donnefort
2022-05-05 18:41   ` Dietmar Eggemann [this message]
2022-04-29 14:11 ` [PATCH v8 7/7] sched/fair: Remove the energy margin " Vincent Donnefort
2022-05-05 18:42   ` Dietmar Eggemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd29f36a-9063-dae6-4526-85494c221bd2@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=chris.redpath@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=tao.zhou@linux.dev \
    --cc=vdonnefort@gmail.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.