Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620765 > unrolled thread

[RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2017-04-11 00:30 +0200
Last post2017-04-17 07:50 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-04-11 00:30 +0200
    Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent  transition delays Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-11 13:20 +0200
      Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent  transition delays "Rafael J. Wysocki" <rafael@kernel.org> - 2017-04-11 16:10 +0200
    Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-04-15 01:00 +0200
      Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent  transition delays Joel Fernandes <joelaf@google.com> - 2017-04-15 04:30 +0200
      Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays Brendan Jackman <brendan.jackman@arm.com> - 2017-04-18 11:50 +0200
    Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent  transition delays Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-17 07:50 +0200

#1620765 — [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-04-11 00:30 +0200
Subject[RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays
Message-ID<tuPYS-6Qk-17@gated-at.bofh.it>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Make the schedutil governor take the initial (default) value of the
rate_limit_us sysfs attribute from the (new) transition_delay_us
policy parameter (to be set by the scaling driver).

That will allow scaling drivers to make schedutil use smaller default
values of rate_limit_us and reduce the default average time interval
between consecutive frequency changes.

Make intel_pstate set transition_delay_us to 500.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

This is a replacement for https://patchwork.kernel.org/patch/9671831/

---
 drivers/cpufreq/intel_pstate.c   |    2 ++
 include/linux/cpufreq.h          |    7 +++++++
 kernel/sched/cpufreq_schedutil.c |   15 ++++++++++-----
 3 files changed, 19 insertions(+), 5 deletions(-)

Index: linux-pm/include/linux/cpufreq.h
===================================================================
--- linux-pm.orig/include/linux/cpufreq.h
+++ linux-pm/include/linux/cpufreq.h
@@ -120,6 +120,13 @@ struct cpufreq_policy {
 	bool			fast_switch_possible;
 	bool			fast_switch_enabled;
 
+	/*
+	 * Preferred average time interval between consecutive invocations of
+	 * the driver to set the frequency for this policy.  To be set by the
+	 * scaling driver (0, which is the default, means no preference).
+	 */
+	unsigned int		transition_delay_us;
+
 	 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
 	unsigned int cached_target_freq;
 	int cached_resolved_idx;
Index: linux-pm/kernel/sched/cpufreq_schedutil.c
===================================================================
--- linux-pm.orig/kernel/sched/cpufreq_schedutil.c
+++ linux-pm/kernel/sched/cpufreq_schedutil.c
@@ -491,7 +491,6 @@ static int sugov_init(struct cpufreq_pol
 {
 	struct sugov_policy *sg_policy;
 	struct sugov_tunables *tunables;
-	unsigned int lat;
 	int ret = 0;
 
 	/* State should be equivalent to EXIT */
@@ -530,10 +529,16 @@ static int sugov_init(struct cpufreq_pol
 		goto stop_kthread;
 	}
 
-	tunables->rate_limit_us = LATENCY_MULTIPLIER;
-	lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
-	if (lat)
-		tunables->rate_limit_us *= lat;
+	if (policy->transition_delay_us) {
+		tunables->rate_limit_us = policy->transition_delay_us;
+	} else {
+		unsigned int lat;
+
+		tunables->rate_limit_us = LATENCY_MULTIPLIER;
+		lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
+		if (lat)
+			tunables->rate_limit_us *= lat;
+	}
 
 	policy->governor_data = sg_policy;
 	sg_policy->tunables = tunables;
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -41,6 +41,7 @@
 #define INTEL_PSTATE_HWP_SAMPLING_INTERVAL	(50 * NSEC_PER_MSEC)
 
 #define INTEL_CPUFREQ_TRANSITION_LATENCY	20000
+#define INTEL_CPUFREQ_TRANSITION_DELAY		500
 
 #ifdef CONFIG_ACPI
 #include <acpi/processor.h>
@@ -2237,6 +2238,7 @@ static int intel_cpufreq_cpu_init(struct
 		return ret;
 
 	policy->cpuinfo.transition_latency = INTEL_CPUFREQ_TRANSITION_LATENCY;
+	policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY;
 	/* This reflects the intel_pstate_get_cpu_pstates() setting. */
 	policy->cur = policy->cpuinfo.min_freq;
 

[toc] | [next] | [standalone]


#1621160 — Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-04-11 13:20 +0200
SubjectRe: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays
Message-ID<tv201-6fx-11@gated-at.bofh.it>
In reply to#1620765
On 11-04-17, 00:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Make the schedutil governor take the initial (default) value of the
> rate_limit_us sysfs attribute from the (new) transition_delay_us
> policy parameter (to be set by the scaling driver).
> 
> That will allow scaling drivers to make schedutil use smaller default
> values of rate_limit_us and reduce the default average time interval
> between consecutive frequency changes.
> 
> Make intel_pstate set transition_delay_us to 500.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> This is a replacement for https://patchwork.kernel.org/patch/9671831/
> 
> ---
>  drivers/cpufreq/intel_pstate.c   |    2 ++
>  include/linux/cpufreq.h          |    7 +++++++
>  kernel/sched/cpufreq_schedutil.c |   15 ++++++++++-----
>  3 files changed, 19 insertions(+), 5 deletions(-)

Should we use this new value for the ondemand/conservative governors as well?

-- 
viresh

[toc] | [prev] | [next] | [standalone]


#1621308 — Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-04-11 16:10 +0200
SubjectRe: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays
Message-ID<tv4Ey-823-5@gated-at.bofh.it>
In reply to#1621160
On Tue, Apr 11, 2017 at 1:14 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 11-04-17, 00:20, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> Make the schedutil governor take the initial (default) value of the
>> rate_limit_us sysfs attribute from the (new) transition_delay_us
>> policy parameter (to be set by the scaling driver).
>>
>> That will allow scaling drivers to make schedutil use smaller default
>> values of rate_limit_us and reduce the default average time interval
>> between consecutive frequency changes.
>>
>> Make intel_pstate set transition_delay_us to 500.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> ---
>>
>> This is a replacement for https://patchwork.kernel.org/patch/9671831/
>>
>> ---
>>  drivers/cpufreq/intel_pstate.c   |    2 ++
>>  include/linux/cpufreq.h          |    7 +++++++
>>  kernel/sched/cpufreq_schedutil.c |   15 ++++++++++-----
>>  3 files changed, 19 insertions(+), 5 deletions(-)
>
> Should we use this new value for the ondemand/conservative governors as well?

We might, but it is mostly for schedutil.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1623948

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-04-15 01:00 +0200
Message-ID<twim6-71X-11@gated-at.bofh.it>
In reply to#1620765
On Tuesday, April 11, 2017 12:20:41 AM Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Make the schedutil governor take the initial (default) value of the
> rate_limit_us sysfs attribute from the (new) transition_delay_us
> policy parameter (to be set by the scaling driver).
> 
> That will allow scaling drivers to make schedutil use smaller default
> values of rate_limit_us and reduce the default average time interval
> between consecutive frequency changes.
> 
> Make intel_pstate set transition_delay_us to 500.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> This is a replacement for https://patchwork.kernel.org/patch/9671831/

Any concerns about this one?

> 
> ---
>  drivers/cpufreq/intel_pstate.c   |    2 ++
>  include/linux/cpufreq.h          |    7 +++++++
>  kernel/sched/cpufreq_schedutil.c |   15 ++++++++++-----
>  3 files changed, 19 insertions(+), 5 deletions(-)
> 
> Index: linux-pm/include/linux/cpufreq.h
> ===================================================================
> --- linux-pm.orig/include/linux/cpufreq.h
> +++ linux-pm/include/linux/cpufreq.h
> @@ -120,6 +120,13 @@ struct cpufreq_policy {
>  	bool			fast_switch_possible;
>  	bool			fast_switch_enabled;
>  
> +	/*
> +	 * Preferred average time interval between consecutive invocations of
> +	 * the driver to set the frequency for this policy.  To be set by the
> +	 * scaling driver (0, which is the default, means no preference).
> +	 */
> +	unsigned int		transition_delay_us;
> +
>  	 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
>  	unsigned int cached_target_freq;
>  	int cached_resolved_idx;
> Index: linux-pm/kernel/sched/cpufreq_schedutil.c
> ===================================================================
> --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c
> +++ linux-pm/kernel/sched/cpufreq_schedutil.c
> @@ -491,7 +491,6 @@ static int sugov_init(struct cpufreq_pol
>  {
>  	struct sugov_policy *sg_policy;
>  	struct sugov_tunables *tunables;
> -	unsigned int lat;
>  	int ret = 0;
>  
>  	/* State should be equivalent to EXIT */
> @@ -530,10 +529,16 @@ static int sugov_init(struct cpufreq_pol
>  		goto stop_kthread;
>  	}
>  
> -	tunables->rate_limit_us = LATENCY_MULTIPLIER;
> -	lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
> -	if (lat)
> -		tunables->rate_limit_us *= lat;
> +	if (policy->transition_delay_us) {
> +		tunables->rate_limit_us = policy->transition_delay_us;
> +	} else {
> +		unsigned int lat;
> +
> +		tunables->rate_limit_us = LATENCY_MULTIPLIER;
> +		lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
> +		if (lat)
> +			tunables->rate_limit_us *= lat;
> +	}
>  
>  	policy->governor_data = sg_policy;
>  	sg_policy->tunables = tunables;
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -41,6 +41,7 @@
>  #define INTEL_PSTATE_HWP_SAMPLING_INTERVAL	(50 * NSEC_PER_MSEC)
>  
>  #define INTEL_CPUFREQ_TRANSITION_LATENCY	20000
> +#define INTEL_CPUFREQ_TRANSITION_DELAY		500
>  
>  #ifdef CONFIG_ACPI
>  #include <acpi/processor.h>
> @@ -2237,6 +2238,7 @@ static int intel_cpufreq_cpu_init(struct
>  		return ret;
>  
>  	policy->cpuinfo.transition_latency = INTEL_CPUFREQ_TRANSITION_LATENCY;
> +	policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY;
>  	/* This reflects the intel_pstate_get_cpu_pstates() setting. */
>  	policy->cur = policy->cpuinfo.min_freq;
>  
> 

[toc] | [prev] | [next] | [standalone]


#1623972 — Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

FromJoel Fernandes <joelaf@google.com>
Date2017-04-15 04:30 +0200
SubjectRe: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays
Message-ID<twlDk-Ts-1@gated-at.bofh.it>
In reply to#1623948
On Fri, Apr 14, 2017 at 3:51 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Tuesday, April 11, 2017 12:20:41 AM Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> Make the schedutil governor take the initial (default) value of the
>> rate_limit_us sysfs attribute from the (new) transition_delay_us
>> policy parameter (to be set by the scaling driver).
>>
>> That will allow scaling drivers to make schedutil use smaller default
>> values of rate_limit_us and reduce the default average time interval
>> between consecutive frequency changes.
>>
>> Make intel_pstate set transition_delay_us to 500.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> ---
>>
>> This is a replacement for https://patchwork.kernel.org/patch/9671831/
>
> Any concerns about this one?

Looks good to me.

Thanks,
Joel

[toc] | [prev] | [next] | [standalone]


#1625195

FromBrendan Jackman <brendan.jackman@arm.com>
Date2017-04-18 11:50 +0200
Message-ID<txxVM-4zJ-17@gated-at.bofh.it>
In reply to#1623948
Hi Rafael,

On Fri, Apr 14 2017 at 22:51, Rafael J. Wysocki wrote:
> On Tuesday, April 11, 2017 12:20:41 AM Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> Make the schedutil governor take the initial (default) value of the
>> rate_limit_us sysfs attribute from the (new) transition_delay_us
>> policy parameter (to be set by the scaling driver).
>>
>> That will allow scaling drivers to make schedutil use smaller default
>> values of rate_limit_us and reduce the default average time interval
>> between consecutive frequency changes.
>>
>> Make intel_pstate set transition_delay_us to 500.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> ---
>>
>> This is a replacement for https://patchwork.kernel.org/patch/9671831/
>
> Any concerns about this one?

Sorry for the delay. This looked good to me.

Cheers
Brendan

[toc] | [prev] | [next] | [standalone]


#1624536 — Re: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-04-17 07:50 +0200
SubjectRe: [RFC/RFT][PATCH 1/2] cpufreq: schedutil: Use policy-dependent transition delays
Message-ID<tx7HY-5hm-3@gated-at.bofh.it>
In reply to#1620765
On 11-04-17, 00:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Make the schedutil governor take the initial (default) value of the
> rate_limit_us sysfs attribute from the (new) transition_delay_us
> policy parameter (to be set by the scaling driver).
> 
> That will allow scaling drivers to make schedutil use smaller default
> values of rate_limit_us and reduce the default average time interval
> between consecutive frequency changes.
> 
> Make intel_pstate set transition_delay_us to 500.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> This is a replacement for https://patchwork.kernel.org/patch/9671831/

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

-- 
viresh

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web