diff mbox series

cpufreq: schedutil: fix equation in comment

Message ID 20190802104628.8410-1-qais.yousef@arm.com (mailing list archive)
State Mainlined, archived
Headers show
Series cpufreq: schedutil: fix equation in comment | expand

Commit Message

Qais Yousef Aug. 2, 2019, 10:46 a.m. UTC
scale_irq_capacity() call in schedutil_cpu_util() does

	util *= (max - irq)
	util /= max

But the comment says

	util *= (1 - irq)
	util /= max

Fix the comment to match what the scaling function does.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 kernel/sched/cpufreq_schedutil.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Vincent Guittot Aug. 2, 2019, 1:19 p.m. UTC | #1
On Fri, 2 Aug 2019 at 12:46, Qais Yousef <qais.yousef@arm.com> wrote:
>
> scale_irq_capacity() call in schedutil_cpu_util() does
>
>         util *= (max - irq)
>         util /= max
>
> But the comment says
>
>         util *= (1 - irq)
>         util /= max
>
> Fix the comment to match what the scaling function does.
>
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>

FWIW
Acked-by:  Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  kernel/sched/cpufreq_schedutil.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 636ca6f88c8e..e127d89d5974 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -259,9 +259,9 @@ unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs,
>          * irq metric. Because IRQ/steal time is hidden from the task clock we
>          * need to scale the task numbers:
>          *
> -        *              1 - irq
> -        *   U' = irq + ------- * U
> -        *                max
> +        *              max - irq
> +        *   U' = irq + --------- * U
> +        *                 max
>          */
>         util = scale_irq_capacity(util, irq, max);
>         util += irq;
> --
> 2.17.1
>
Viresh Kumar Aug. 5, 2019, 4:54 a.m. UTC | #2
On 02-08-19, 11:46, Qais Yousef wrote:
> scale_irq_capacity() call in schedutil_cpu_util() does
> 
> 	util *= (max - irq)
> 	util /= max
> 
> But the comment says
> 
> 	util *= (1 - irq)
> 	util /= max
> 
> Fix the comment to match what the scaling function does.
> 
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> ---
>  kernel/sched/cpufreq_schedutil.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 636ca6f88c8e..e127d89d5974 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -259,9 +259,9 @@ unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs,
>  	 * irq metric. Because IRQ/steal time is hidden from the task clock we
>  	 * need to scale the task numbers:
>  	 *
> -	 *              1 - irq
> -	 *   U' = irq + ------- * U
> -	 *                max
> +	 *              max - irq
> +	 *   U' = irq + --------- * U
> +	 *                 max
>  	 */
>  	util = scale_irq_capacity(util, irq, max);
>  	util += irq;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Peter Zijlstra Aug. 5, 2019, 1:06 p.m. UTC | #3
On Fri, Aug 02, 2019 at 11:46:28AM +0100, Qais Yousef wrote:
> scale_irq_capacity() call in schedutil_cpu_util() does
> 
> 	util *= (max - irq)
> 	util /= max
> 
> But the comment says
> 
> 	util *= (1 - irq)
> 	util /= max
> 
> Fix the comment to match what the scaling function does.
> 
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>

Thanks!
Rafael J. Wysocki Aug. 7, 2019, 9:42 a.m. UTC | #4
On Monday, August 5, 2019 3:06:20 PM CEST Peter Zijlstra wrote:
> On Fri, Aug 02, 2019 at 11:46:28AM +0100, Qais Yousef wrote:
> > scale_irq_capacity() call in schedutil_cpu_util() does
> > 
> > 	util *= (max - irq)
> > 	util /= max
> > 
> > But the comment says
> > 
> > 	util *= (1 - irq)
> > 	util /= max
> > 
> > Fix the comment to match what the scaling function does.
> > 
> > Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> 
> Thanks!
> 

I've applied this, so please let me know if it has gone into -tip too and I'll drop it then.
Qais Yousef Aug. 8, 2019, 11:44 a.m. UTC | #5
On 08/07/19 11:42, Rafael J. Wysocki wrote:
> On Monday, August 5, 2019 3:06:20 PM CEST Peter Zijlstra wrote:
> > On Fri, Aug 02, 2019 at 11:46:28AM +0100, Qais Yousef wrote:
> > > scale_irq_capacity() call in schedutil_cpu_util() does
> > > 
> > > 	util *= (max - irq)
> > > 	util /= max
> > > 
> > > But the comment says
> > > 
> > > 	util *= (1 - irq)
> > > 	util /= max
> > > 
> > > Fix the comment to match what the scaling function does.
> > > 
> > > Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> > 
> > Thanks!
> > 
> 
> I've applied this, so please let me know if it has gone into -tip too and I'll drop it then.

FYI I've just got an email from tip-bot that it was committed there.

Thanks!

--
Qais Yousef
diff mbox series

Patch

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 636ca6f88c8e..e127d89d5974 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -259,9 +259,9 @@  unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs,
 	 * irq metric. Because IRQ/steal time is hidden from the task clock we
 	 * need to scale the task numbers:
 	 *
-	 *              1 - irq
-	 *   U' = irq + ------- * U
-	 *                max
+	 *              max - irq
+	 *   U' = irq + --------- * U
+	 *                 max
 	 */
 	util = scale_irq_capacity(util, irq, max);
 	util += irq;