All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq: intel_pstate: Two cleanups
@ 2019-02-15 12:13 Rafael J. Wysocki
  2019-02-15 12:15 ` [PATCH 1/2] cpufreq: intel_pstate: Avoid redundant initialization of local vars Rafael J. Wysocki
  2019-02-15 12:16 ` [PATCH 2/2] cpufreq: intel_pstate: Eliminate intel_pstate_get_base_pstate() Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-02-15 12:13 UTC (permalink / raw)
  To: Linux PM; +Cc: Srinivas Pandruvada, LKML, Chen Yu, Doug Smythies

Hi All,

These are just two simple cleanups for intel_pstate, without any expected
functional changes.

Thanks,
Rafael


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

* [PATCH 1/2] cpufreq: intel_pstate: Avoid redundant initialization of local vars
  2019-02-15 12:13 [PATCH 0/2] cpufreq: intel_pstate: Two cleanups Rafael J. Wysocki
@ 2019-02-15 12:15 ` Rafael J. Wysocki
  2019-02-15 12:16 ` [PATCH 2/2] cpufreq: intel_pstate: Eliminate intel_pstate_get_base_pstate() Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-02-15 12:15 UTC (permalink / raw)
  To: Linux PM; +Cc: Srinivas Pandruvada, LKML, Chen Yu, Doug Smythies

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

After commit 1a4fe38add8b ("cpufreq: intel_pstate: Remove max/min
fractions to limit performance") the initial value of the pstate local
variable in intel_pstate_max_within_limits() and the initial value of
the max_pstate local variable in intel_pstate_prepare_request() are
both immediately discarded, so initialize both these variables to
their target values upfront.

No intentional changes of behavior.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1473,11 +1473,9 @@ static void intel_pstate_set_min_pstate(
 
 static void intel_pstate_max_within_limits(struct cpudata *cpu)
 {
-	int pstate;
+	int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio);
 
 	update_turbo_state();
-	pstate = intel_pstate_get_base_pstate(cpu);
-	pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio);
 	intel_pstate_set_pstate(cpu, pstate);
 }
 
@@ -1715,11 +1713,9 @@ static inline int32_t get_target_pstate(
 
 static int intel_pstate_prepare_request(struct cpudata *cpu, int pstate)
 {
-	int max_pstate = intel_pstate_get_base_pstate(cpu);
-	int min_pstate;
+	int min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio);
+	int max_pstate = max(min_pstate, cpu->max_perf_ratio);
 
-	min_pstate = max(cpu->pstate.min_pstate, cpu->min_perf_ratio);
-	max_pstate = max(min_pstate, cpu->max_perf_ratio);
 	return clamp_t(int, pstate, min_pstate, max_pstate);
 }
 


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

* [PATCH 2/2] cpufreq: intel_pstate: Eliminate intel_pstate_get_base_pstate()
  2019-02-15 12:13 [PATCH 0/2] cpufreq: intel_pstate: Two cleanups Rafael J. Wysocki
  2019-02-15 12:15 ` [PATCH 1/2] cpufreq: intel_pstate: Avoid redundant initialization of local vars Rafael J. Wysocki
@ 2019-02-15 12:16 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-02-15 12:16 UTC (permalink / raw)
  To: Linux PM; +Cc: Srinivas Pandruvada, LKML, Chen Yu, Doug Smythies

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

There is only one caller of intel_pstate_get_base_pstate() and it is
more straightforward to carry out the computation directly in the
caller, so do that and drop intel_pstate_get_base_pstate().

No intentional changes of behavior.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1447,12 +1447,6 @@ static int knl_get_turbo_pstate(void)
 	return ret;
 }
 
-static int intel_pstate_get_base_pstate(struct cpudata *cpu)
-{
-	return global.no_turbo || global.turbo_disabled ?
-			cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
-}
-
 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
 {
 	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
@@ -1973,7 +1967,8 @@ static void intel_pstate_update_perf_lim
 	if (hwp_active) {
 		intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state);
 	} else {
-		max_state = intel_pstate_get_base_pstate(cpu);
+		max_state = global.no_turbo || global.turbo_disabled ?
+			cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
 		turbo_max = cpu->pstate.turbo_pstate;
 	}
 


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

end of thread, other threads:[~2019-02-15 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-15 12:13 [PATCH 0/2] cpufreq: intel_pstate: Two cleanups Rafael J. Wysocki
2019-02-15 12:15 ` [PATCH 1/2] cpufreq: intel_pstate: Avoid redundant initialization of local vars Rafael J. Wysocki
2019-02-15 12:16 ` [PATCH 2/2] cpufreq: intel_pstate: Eliminate intel_pstate_get_base_pstate() Rafael J. Wysocki

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.