linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Philippe Longepe <philippe.longepe@linux.intel.com>
Cc: linux-pm@vger.kernel.org, rafael@kernel.org, len.brown@intel.com
Subject: Re: [PATCH V4] intel_pstate: Use avg_pstate instead of current_pstate
Date: Thu, 21 Apr 2016 17:59:05 -0700	[thread overview]
Message-ID: <1461286745.8946.203.camel@linux.intel.com> (raw)
In-Reply-To: <1662176.YWLDtbbot1@vostro.rjw.lan>

On Fri, 2016-04-22 at 02:48 +0200, Rafael J. Wysocki wrote:
> On Monday, April 04, 2016 09:23:36 AM Philippe Longepe wrote:
> > 
> > The result returned by pid_calc() is subtracted from current_pstate
> > (which is the pstate requested during the last period) in order to
> > obtain the target pstate for the current iteration.
> > However, current_pstate may not reflect the real current P-state of
> > the CPU.  In particular, that P-state may be higher because of the
> > frequency sharing per module.
> > 
> > The theory is:
> > 
> > - The load is the percentage of time spent in C0 and is related to
> > the average frequency during the same period (We'll not have the
> > same load at 1GHz or at 2GHz for the same task running).
> > 
> > - The current frequency can be completely different than the
> > average frequency (because of frequency sharing or throttling).
> > 
> > => The frequency shift computed by the pid_calc is based on the
> > load, so it must be applied to the frequency with which the load
> > was measured.
> > 
> > Using the average pstate instead of current pstate solve some
> > migration issues (e.g when a task migrates from one core to another
> > in the same package/module and all of the cores in there except for
> > that particular one are basically idle).
> > 
> > Performance and power comparison with this patch on Android:
> > 
> > IPLoad+Avg-Pstate vs IP Load:
> > 
> > Benchmark               ∆Perf    ∆Power
> > FishTank                10.45%    3.1%
> > SmartBench-Gaming       -0.1%   -10.4%
> > SmartBench-Productivity -0.8%   -10.4%
> > CandyCrush                n/a   -17.4%
> > AngryBirds                n/a    -5.9%
> > videoPlayback             n/a   -13.9%
> > audioPlayback             n/a    -4.9%
> > IcyRocks-20-50           0.0%   -38.4%
> > iozone RR               -0.16%  -1.3%
> > iozone RW                0.74%  -1.3%
> > 
> > Comparison with the perf algorithm:
> > (this patch in cpu_load vs Core algorithm)
> > 
> > Benchmark               ∆Perf    ∆Power
> > SmartBench-Gaming       -0.58%   -22.8%
> > SmartBench-Productivity  0.82%
> > CandyCrush                n/a    -20.8%
> > AngryBirds                n/a    -37.0%
> > videoPlayback             n/a    -53.4%
> > audioPlayback             n/a     -2.1%
> > iozone RR               -0.55%   -13.29%
> > iozone RW                2.22%
> > 
> > => No regression > 1% observed and a huge power improvement!
> > 
> > Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com>


> Srinivas, what about this one?  Yes?  No?  Maybe?
> 
I am fine with this change.
I would like to edit the commit and remove the bottom table compare
with core and statement with exclamation as this not relevant here for
the affected platforms.

Do you want me to send update?


Thanks,
Srinivas

> > 
> > ---
> >  drivers/cpufreq/intel_pstate.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cpufreq/intel_pstate.c
> > b/drivers/cpufreq/intel_pstate.c
> > index 4b64452..b998e1d 100644
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -919,6 +919,12 @@ static inline int32_t get_avg_frequency(struct
> > cpudata *cpu)
> >  		cpu->pstate.scaling, cpu->sample.mperf);
> >  }
> >  
> > +static inline int32_t get_avg_pstate(struct cpudata *cpu)
> > +{
> > +	return div64_u64(cpu->pstate.max_pstate_physical * cpu-
> > >sample.aperf,
> > +		cpu->sample.mperf);
> > +}
> > +
> >  static inline int32_t get_target_pstate_use_cpu_load(struct
> > cpudata *cpu)
> >  {
> >  	struct sample *sample = &cpu->sample;
> > @@ -951,7 +957,7 @@ static inline int32_t
> > get_target_pstate_use_cpu_load(struct cpudata *cpu)
> >  	cpu_load = div64_u64(int_tofp(100) * mperf, sample->tsc);
> >  	cpu->sample.busy_scaled = cpu_load;
> >  
> > -	return cpu->pstate.current_pstate - pid_calc(&cpu->pid,
> > cpu_load);
> > +	return get_avg_pstate(cpu) - pid_calc(&cpu->pid,
> > cpu_load);
> >  }
> >  
> >  static inline int32_t get_target_pstate_use_performance(struct
> > cpudata *cpu)
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-04-22  0:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04  7:23 [PATCH V4] intel_pstate: Use avg_pstate instead of current_pstate Philippe Longepe
2016-04-04  7:23 ` Philippe Longepe
2016-04-22  0:48 ` Rafael J. Wysocki
2016-04-22  0:59   ` Srinivas Pandruvada [this message]
2016-04-22  1:01     ` Rafael J. Wysocki
2016-04-22 15:18       ` Doug Smythies
2016-04-22 16:26         ` Srinivas Pandruvada

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=1461286745.8946.203.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=philippe.longepe@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).