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


Groups > linux.kernel > #1336962

[PATCH 7/12] cpufreq: ondemand: Rework the handling of powersave bias updates

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject [PATCH 7/12] cpufreq: ondemand: Rework the handling of powersave bias updates
Date 2016-02-18 02:50 +0100
Message-ID <r3lTd-6Da-27@gated-at.bofh.it> (permalink)
References <r3lJv-6xI-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

The ondemand_powersave_bias_init() function used for resetting data
fields related to the powersave bias tunable of the ondemand governor
works by walking all of the online CPUs in the system and updating the
od_cpu_dbs_info_s structures for all of them.

However, if governor tunables are per policy, the update should not
touch the CPUs that are not associated with the given dbs_data.

Moreover, since the data fields in question are only ever used for
policy->cpu in each policy governed by ondemand, the update can be
limited to those specific CPUs.

Rework the code to take the above observations into account.

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

Index: linux-pm/drivers/cpufreq/cpufreq_ondemand.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq_ondemand.c
+++ linux-pm/drivers/cpufreq/cpufreq_ondemand.c
@@ -34,14 +34,6 @@ static struct od_ops od_ops;
 
 static unsigned int default_powersave_bias;
 
-static void ondemand_powersave_bias_init_cpu(int cpu)
-{
-	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
-
-	dbs_info->freq_table = cpufreq_frequency_get_table(cpu);
-	dbs_info->freq_lo = 0;
-}
-
 /*
  * Not all CPUs want IO time to be accounted as busy; this depends on how
  * efficient idling at a higher frequency/voltage is.
@@ -120,12 +112,13 @@ static unsigned int generic_powersave_bi
 	return freq_hi;
 }
 
-static void ondemand_powersave_bias_init(void)
+static void ondemand_powersave_bias_init(struct cpufreq_policy *policy)
 {
-	int i;
-	for_each_online_cpu(i) {
-		ondemand_powersave_bias_init_cpu(i);
-	}
+	unsigned int cpu = policy->cpu;
+	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
+
+	dbs_info->freq_table = cpufreq_frequency_get_table(cpu);
+	dbs_info->freq_lo = 0;
 }
 
 static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
@@ -306,6 +299,7 @@ static ssize_t store_powersave_bias(stru
 		size_t count)
 {
 	struct od_dbs_tuners *od_tuners = dbs_data->tuners;
+	struct policy_dbs_info *policy_dbs;
 	unsigned int input;
 	int ret;
 	ret = sscanf(buf, "%u", &input);
@@ -317,7 +311,10 @@ static ssize_t store_powersave_bias(stru
 		input = 1000;
 
 	od_tuners->powersave_bias = input;
-	ondemand_powersave_bias_init();
+
+	list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list)
+		ondemand_powersave_bias_init(policy_dbs->policy);
+
 	return count;
 }
 
@@ -398,11 +395,10 @@ static void od_exit(struct dbs_data *dbs
 
 static void od_start(struct cpufreq_policy *policy)
 {
-	unsigned int cpu = policy->cpu;
-	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
+	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, policy->cpu);
 
 	dbs_info->sample_type = OD_NORMAL_SAMPLE;
-	ondemand_powersave_bias_init_cpu(cpu);
+	ondemand_powersave_bias_init(policy);
 }
 
 define_get_cpu_dbs_routines(od_cpu_dbs_info);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/12] cpufreq: More governor code reorganization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:40 +0100
  [PATCH 11/12] cpufreq: governor: Make dbs_data_mutex static "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 11/12] cpufreq: governor: Make dbs_data_mutex static Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 07:10 +0100
  [PATCH 4/12] cpufreq: governor: Drop unused governor callback and data fields "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 4/12] cpufreq: governor: Drop unused governor callback  and data fields Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 06:40 +0100
  [PATCH 5/12] cpufreq: ondemand: Drop one more callback from struct od_ops "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 5/12] cpufreq: ondemand: Drop one more callback from  struct od_ops Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 06:40 +0100
  [PATCH 8/12] cpufreq: governor: Make governor private data per-policy "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 8/12] cpufreq: governor: Make governor private data  per-policy Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 07:10 +0100
      [PATCH v2 8/12] cpufreq: governor: Make governor private data per-policy "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 19:00 +0100
        Re: [PATCH v2 8/12] cpufreq: governor: Make governor private data  per-policy Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-19 03:40 +0100
  [PATCH 6/12] cpufreq: governor: Fix CPU load information updates via ->store "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 6/12] cpufreq: governor: Fix CPU load information updates  via ->store Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 06:50 +0100
      Re: [PATCH 6/12] cpufreq: governor: Fix CPU load information updates  via ->store "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-18 18:40 +0100
  [PATCH 7/12] cpufreq: ondemand: Rework the handling of powersave bias updates "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 7/12] cpufreq: ondemand: Rework the handling of powersave  bias updates Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 07:00 +0100
  [PATCH 12/12] cpufreq: governor: Narrow down the dbs_data_mutex coverage "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 02:50 +0100
    Re: [PATCH 12/12] cpufreq: governor: Narrow down the dbs_data_mutex  coverage Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-18 07:30 +0100
      Re: [PATCH 12/12] cpufreq: governor: Narrow down the dbs_data_mutex coverage "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-18 17:40 +0100
      [PATCH v2 12/12] cpufreq: governor: Narrow down the dbs_data_mutex coverage "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-02-18 19:00 +0100
        Re: [PATCH v2 12/12] cpufreq: governor: Narrow down the  dbs_data_mutex coverage Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-19 03:40 +0100

csiph-web