All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: cpufreq: ignore SMT when determining max cpu capacity
@ 2016-08-19 20:43 Steve Muckle
  2016-08-24  8:31 ` Morten Rasmussen
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Muckle @ 2016-08-19 20:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Rafael J . Wysocki
  Cc: linux-kernel, linux-pm, Vincent Guittot, Morten Rasmussen,
	Dietmar Eggemann, Juri Lelli, Patrick Bellasi, Steve Muckle

PELT does not consider SMT when scaling its utilization values via
arch_scale_cpu_capacity(). The value in rq->cpu_capacity_orig does
take SMT into consideration though and therefore may be smaller than
the utilization reported by PELT.

On an Intel i7-3630QM for example rq->cpu_capacity_orig is 589 but
util_avg scales up to 1024. This means that a 50% utilized CPU will show
up in schedutil as ~86% busy.

Fix this by using the same CPU scaling value in schedutil as that which
is used by PELT.

Signed-off-by: Steve Muckle <smuckle@linaro.org>
---
 kernel/sched/cpufreq_schedutil.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 60d985f4dc47..cb8a77b1ef1b 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -147,7 +147,9 @@ static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util,
 static void sugov_get_util(unsigned long *util, unsigned long *max)
 {
 	struct rq *rq = this_rq();
-	unsigned long cfs_max = rq->cpu_capacity_orig;
+	unsigned long cfs_max;
+
+	cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id());
 
 	*util = min(rq->cfs.avg.util_avg, cfs_max);
 	*max = cfs_max;
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched: cpufreq: ignore SMT when determining max cpu capacity
  2016-08-19 20:43 [PATCH] sched: cpufreq: ignore SMT when determining max cpu capacity Steve Muckle
@ 2016-08-24  8:31 ` Morten Rasmussen
  0 siblings, 0 replies; 2+ messages in thread
From: Morten Rasmussen @ 2016-08-24  8:31 UTC (permalink / raw)
  To: Steve Muckle
  Cc: Peter Zijlstra, Ingo Molnar, Rafael J . Wysocki, linux-kernel,
	linux-pm, Vincent Guittot, Dietmar Eggemann, Juri Lelli,
	Patrick Bellasi, Steve Muckle

On Fri, Aug 19, 2016 at 01:43:47PM -0700, Steve Muckle wrote:
> PELT does not consider SMT when scaling its utilization values via
> arch_scale_cpu_capacity(). The value in rq->cpu_capacity_orig does
> take SMT into consideration though and therefore may be smaller than
> the utilization reported by PELT.
> 
> On an Intel i7-3630QM for example rq->cpu_capacity_orig is 589 but
> util_avg scales up to 1024. This means that a 50% utilized CPU will show
> up in schedutil as ~86% busy.
> 
> Fix this by using the same CPU scaling value in schedutil as that which
> is used by PELT.
> 
> Signed-off-by: Steve Muckle <smuckle@linaro.org>
> ---
>  kernel/sched/cpufreq_schedutil.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 60d985f4dc47..cb8a77b1ef1b 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -147,7 +147,9 @@ static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util,
>  static void sugov_get_util(unsigned long *util, unsigned long *max)
>  {
>  	struct rq *rq = this_rq();
> -	unsigned long cfs_max = rq->cpu_capacity_orig;
> +	unsigned long cfs_max;
> +
> +	cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id());

Until we have figured out how to define utilization (and capacity)
better for SMT I think this is a better solution.

Morten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-24  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 20:43 [PATCH] sched: cpufreq: ignore SMT when determining max cpu capacity Steve Muckle
2016-08-24  8:31 ` Morten Rasmussen

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.