mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq: intel_pstate: Minor simplifications
@ 2017-08-04 13:01 Rafael J. Wysocki
  2017-08-04 13:02 ` [PATCH 1/2] cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate() Rafael J. Wysocki
  2017-08-04 13:04 ` [PATCH 2/2] cpufreq: intel_pstate: Shorten a couple of long names Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-08-04 13:01 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Srinivas Pandruvada

Hi,

The following two patches simplify intel_pstate code slightly (on top of the
current linux-next).

Thanks,
Rafael

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

* [PATCH 1/2] cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate()
  2017-08-04 13:01 [PATCH 0/2] cpufreq: intel_pstate: Minor simplifications Rafael J. Wysocki
@ 2017-08-04 13:02 ` Rafael J. Wysocki
  2017-08-04 13:04 ` [PATCH 2/2] cpufreq: intel_pstate: Shorten a couple of long names Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-08-04 13:02 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Srinivas Pandruvada

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

Since there is only one P-state selection routine in intel_pstate
now, make intel_pstate_adjust_pstate() call it directly and drop
the target_pstate argument from that function.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   12 +++++-------
 1 file changed, 5 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
@@ -1495,13 +1495,15 @@ static void intel_pstate_update_pstate(s
 	wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate));
 }
 
-static void intel_pstate_adjust_pstate(struct cpudata *cpu, int target_pstate)
+static void intel_pstate_adjust_pstate(struct cpudata *cpu)
 {
 	int from = cpu->pstate.current_pstate;
 	struct sample *sample;
+	int target_pstate;
 
 	update_turbo_state();
 
+	target_pstate = get_target_pstate_use_cpu_load(cpu);
 	target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
 	trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu);
 	intel_pstate_update_pstate(cpu, target_pstate);
@@ -1541,12 +1543,8 @@ static void intel_pstate_update_util(str
 	if ((s64)delta_ns < INTEL_PSTATE_DEFAULT_SAMPLING_INTERVAL)
 		return;
 
-	if (intel_pstate_sample(cpu, time)) {
-		int target_pstate;
-
-		target_pstate = get_target_pstate_use_cpu_load(cpu);
-		intel_pstate_adjust_pstate(cpu, target_pstate);
-	}
+	if (intel_pstate_sample(cpu, time))
+		intel_pstate_adjust_pstate(cpu);
 }
 
 static struct pstate_funcs core_funcs = {

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

* [PATCH 2/2] cpufreq: intel_pstate: Shorten a couple of long names
  2017-08-04 13:01 [PATCH 0/2] cpufreq: intel_pstate: Minor simplifications Rafael J. Wysocki
  2017-08-04 13:02 ` [PATCH 1/2] cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate() Rafael J. Wysocki
@ 2017-08-04 13:04 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-08-04 13:04 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Srinivas Pandruvada

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

The names of the INTEL_PSTATE_DEFAULT_SAMPLING_INTERVAL symbol and
the get_target_pstate_use_cpu_load() function don't need to be so
long any more, so make them shorter.

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

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -37,7 +37,7 @@
 #include <asm/cpufeature.h>
 #include <asm/intel-family.h>
 
-#define INTEL_PSTATE_DEFAULT_SAMPLING_INTERVAL	(10 * NSEC_PER_MSEC)
+#define INTEL_PSTATE_SAMPLING_INTERVAL	(10 * NSEC_PER_MSEC)
 
 #define INTEL_CPUFREQ_TRANSITION_LATENCY	20000
 #define INTEL_CPUFREQ_TRANSITION_DELAY		500
@@ -1438,7 +1438,7 @@ static inline int32_t get_avg_pstate(str
 			  cpu->sample.core_avg_perf);
 }
 
-static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
+static inline int32_t get_target_pstate(struct cpudata *cpu)
 {
 	struct sample *sample = &cpu->sample;
 	int32_t busy_frac, boost;
@@ -1503,7 +1503,7 @@ static void intel_pstate_adjust_pstate(s
 
 	update_turbo_state();
 
-	target_pstate = get_target_pstate_use_cpu_load(cpu);
+	target_pstate = get_target_pstate(cpu);
 	target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
 	trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu);
 	intel_pstate_update_pstate(cpu, target_pstate);
@@ -1540,7 +1540,7 @@ static void intel_pstate_update_util(str
 	}
 	cpu->last_update = time;
 	delta_ns = time - cpu->sample.time;
-	if ((s64)delta_ns < INTEL_PSTATE_DEFAULT_SAMPLING_INTERVAL)
+	if ((s64)delta_ns < INTEL_PSTATE_SAMPLING_INTERVAL)
 		return;
 
 	if (intel_pstate_sample(cpu, time))

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

end of thread, other threads:[~2017-08-04 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 13:01 [PATCH 0/2] cpufreq: intel_pstate: Minor simplifications Rafael J. Wysocki
2017-08-04 13:02 ` [PATCH 1/2] cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate() Rafael J. Wysocki
2017-08-04 13:04 ` [PATCH 2/2] cpufreq: intel_pstate: Shorten a couple of long names Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®