2019-08-02 21:12:20

by Qais Yousef

[permalink] [raw]
Subject: [PATCH] cpufreq: schedutil: fix equation in comment

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 <[email protected]>
---
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


2019-08-03 00:06:15

by Vincent Guittot

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: schedutil: fix equation in comment

On Fri, 2 Aug 2019 at 12:46, Qais Yousef <[email protected]> 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 <[email protected]>

FWIW
Acked-by: Vincent Guittot <[email protected]>
> ---
> 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
>

2019-08-05 04:55:33

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: schedutil: fix equation in comment

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 <[email protected]>
> ---
> 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 <[email protected]>

--
viresh

2019-08-05 13:08:08

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: schedutil: fix equation in comment

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 <[email protected]>

Thanks!

2019-08-07 09:43:36

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: schedutil: fix equation in comment

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 <[email protected]>
>
> Thanks!
>

I've applied this, so please let me know if it has gone into -tip too and I'll drop it then.



Subject: [tip:sched/core] cpufreq: schedutil: fix equation in comment

Commit-ID: 5c3ceef9ad7b340b0acee6c26d0c9e6429decb2c
Gitweb: https://git.kernel.org/tip/5c3ceef9ad7b340b0acee6c26d0c9e6429decb2c
Author: Qais Yousef <[email protected]>
AuthorDate: Fri, 2 Aug 2019 11:46:28 +0100
Committer: Peter Zijlstra <[email protected]>
CommitDate: Thu, 8 Aug 2019 09:09:31 +0200

cpufreq: schedutil: fix equation in comment

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 <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
Acked-by: Vincent Guittot <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "Rafael J . Wysocki" <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
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;

2019-08-08 11:45:07

by Qais Yousef

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: schedutil: fix equation in comment

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 <[email protected]>
> >
> > 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