[4/4] cpufreq: schedutil: Don't call sugov_get_util() unnecessarily

Message ID 7b0698a61bcb959704f58dbabe8c70d657210301.1513158452.git.viresh.kumar@linaro.org
State New
Headers show
Series
  • sched: cpufreq: Track util update flags
Related show

Commit Message

Viresh Kumar Dec. 13, 2017, 9:53 a.m.
sugov_update_shared() may get called to clear the scheduling class flags
and we would return immediately in that case. Calling sugov_get_util()
in that case isn't going to be of any use then. Move invocation of
sugov_get_util() after the clear flag is checked.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
 kernel/sched/cpufreq_schedutil.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.15.0.194.g9af6a3dea062

Comments

Viresh Kumar Dec. 13, 2017, 12:02 p.m. | #1
On 13-12-17, 12:34, Juri Lelli wrote:
> It seems that Patrick already posted basically the same change:

> 

> https://patchwork.kernel.org/patch/10084669/


Yeah, only that the reasoning is completely different from what he had (to which
many doubts were raised).

> Also, Cc-ing him for this.. I just noticed he wasn't Cc-ed to the series.


I copied everyone in cc from one of Patrick's email and forgot to copy the guy
in the From field :)

I have bounced all the emails to him now, he should get them.

-- 
viresh
Joel Fernandes Dec. 19, 2017, 3:26 a.m. | #2
On Wed, Dec 13, 2017 at 1:53 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> sugov_update_shared() may get called to clear the scheduling class flags

> and we would return immediately in that case. Calling sugov_get_util()

> in that case isn't going to be of any use then. Move invocation of

> sugov_get_util() after the clear flag is checked.

>

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> ---

>  kernel/sched/cpufreq_schedutil.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c

> index 7edfdc59ee8f..b69c37c867fe 100644

> --- a/kernel/sched/cpufreq_schedutil.c

> +++ b/kernel/sched/cpufreq_schedutil.c

> @@ -349,8 +349,6 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,

>         unsigned long util, max;

>         unsigned int next_f;

>

> -       sugov_get_util(&util, &max, sg_cpu->cpu);

> -

>         raw_spin_lock(&sg_policy->update_lock);

>

>         if (unlikely(flags & SCHED_CPUFREQ_CLEAR)) {

> @@ -358,6 +356,8 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,

>                 goto unlock;

>         }

>

> +       sugov_get_util(&util, &max, sg_cpu->cpu);

> +

>         sg_cpu->util = util;


Reviewed-by: Joel Fernandes <joelaf@google.com>


Thanks,

- Joel

Patch

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 7edfdc59ee8f..b69c37c867fe 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -349,8 +349,6 @@  static void sugov_update_shared(struct update_util_data *hook, u64 time,
 	unsigned long util, max;
 	unsigned int next_f;
 
-	sugov_get_util(&util, &max, sg_cpu->cpu);
-
 	raw_spin_lock(&sg_policy->update_lock);
 
 	if (unlikely(flags & SCHED_CPUFREQ_CLEAR)) {
@@ -358,6 +356,8 @@  static void sugov_update_shared(struct update_util_data *hook, u64 time,
 		goto unlock;
 	}
 
+	sugov_get_util(&util, &max, sg_cpu->cpu);
+
 	sg_cpu->util = util;
 	sg_cpu->max = max;
 	sg_cpu->flags |= flags;