aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_conservative.c
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2011-03-03 15:31:27 -0500
committerDave Jones <davej@redhat.com>2011-03-16 17:54:32 -0400
commit326c86deaed54ad1b364fcafe5073f563671eb58 (patch)
treefb0784c6450d3d618127df3823ffeeda400ac58f /drivers/cpufreq/cpufreq_conservative.c
parente8951251b89440644a39f2512b4f265973926b41 (diff)
[CPUFREQ] Remove unneeded locks
There cannot be any concurrent access to these through different cpu sysfs files anymore, because these tunables are now all global (not per cpu). I still have some doubts whether some of these locks were needed at all. Anyway, let's get rid of them. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dave Jones <davej@redhat.com> CC: cpufreq@vger.kernel.org
Diffstat (limited to 'drivers/cpufreq/cpufreq_conservative.c')
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 3182d85b3374..33b56e5c5c14 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -76,8 +76,7 @@ static DEFINE_PER_CPU(struct cpu_dbs_info_s, cs_cpu_dbs_info);
76static unsigned int dbs_enable; /* number of CPUs using this policy */ 76static unsigned int dbs_enable; /* number of CPUs using this policy */
77 77
78/* 78/*
79 * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on 79 * dbs_mutex protects dbs_enable in governor start/stop.
80 * different CPUs. It protects dbs_enable in governor start/stop.
81 */ 80 */
82static DEFINE_MUTEX(dbs_mutex); 81static DEFINE_MUTEX(dbs_mutex);
83 82
@@ -195,10 +194,7 @@ static ssize_t store_sampling_down_factor(struct kobject *a,
195 if (ret != 1 || input > MAX_SAMPLING_DOWN_FACTOR || input < 1) 194 if (ret != 1 || input > MAX_SAMPLING_DOWN_FACTOR || input < 1)
196 return -EINVAL; 195 return -EINVAL;
197 196
198 mutex_lock(&dbs_mutex);
199 dbs_tuners_ins.sampling_down_factor = input; 197 dbs_tuners_ins.sampling_down_factor = input;
200 mutex_unlock(&dbs_mutex);
201
202 return count; 198 return count;
203} 199}
204 200
@@ -212,10 +208,7 @@ static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
212 if (ret != 1) 208 if (ret != 1)
213 return -EINVAL; 209 return -EINVAL;
214 210
215 mutex_lock(&dbs_mutex);
216 dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate); 211 dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate);
217 mutex_unlock(&dbs_mutex);
218
219 return count; 212 return count;
220} 213}
221 214
@@ -226,16 +219,11 @@ static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
226 int ret; 219 int ret;
227 ret = sscanf(buf, "%u", &input); 220 ret = sscanf(buf, "%u", &input);
228 221
229 mutex_lock(&dbs_mutex);
230 if (ret != 1 || input > 100 || 222 if (ret != 1 || input > 100 ||
231 input <= dbs_tuners_ins.down_threshold) { 223 input <= dbs_tuners_ins.down_threshold)
232 mutex_unlock(&dbs_mutex);
233 return -EINVAL; 224 return -EINVAL;
234 }
235 225
236 dbs_tuners_ins.up_threshold = input; 226 dbs_tuners_ins.up_threshold = input;
237 mutex_unlock(&dbs_mutex);
238
239 return count; 227 return count;
240} 228}
241 229
@@ -246,17 +234,12 @@ static ssize_t store_down_threshold(struct kobject *a, struct attribute *b,
246 int ret; 234 int ret;
247 ret = sscanf(buf, "%u", &input); 235 ret = sscanf(buf, "%u", &input);
248 236
249 mutex_lock(&dbs_mutex);
250 /* cannot be lower than 11 otherwise freq will not fall */ 237 /* cannot be lower than 11 otherwise freq will not fall */
251 if (ret != 1 || input < 11 || input > 100 || 238 if (ret != 1 || input < 11 || input > 100 ||
252 input >= dbs_tuners_ins.up_threshold) { 239 input >= dbs_tuners_ins.up_threshold)
253 mutex_unlock(&dbs_mutex);
254 return -EINVAL; 240 return -EINVAL;
255 }
256 241
257 dbs_tuners_ins.down_threshold = input; 242 dbs_tuners_ins.down_threshold = input;
258 mutex_unlock(&dbs_mutex);
259
260 return count; 243 return count;
261} 244}
262 245
@@ -275,11 +258,9 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
275 if (input > 1) 258 if (input > 1)
276 input = 1; 259 input = 1;
277 260
278 mutex_lock(&dbs_mutex); 261 if (input == dbs_tuners_ins.ignore_nice) /* nothing to do */
279 if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
280 mutex_unlock(&dbs_mutex);
281 return count; 262 return count;
282 } 263
283 dbs_tuners_ins.ignore_nice = input; 264 dbs_tuners_ins.ignore_nice = input;
284 265
285 /* we need to re-evaluate prev_cpu_idle */ 266 /* we need to re-evaluate prev_cpu_idle */
@@ -291,8 +272,6 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
291 if (dbs_tuners_ins.ignore_nice) 272 if (dbs_tuners_ins.ignore_nice)
292 dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice; 273 dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
293 } 274 }
294 mutex_unlock(&dbs_mutex);
295
296 return count; 275 return count;
297} 276}
298 277
@@ -311,10 +290,7 @@ static ssize_t store_freq_step(struct kobject *a, struct attribute *b,
311 290
312 /* no need to test here if freq_step is zero as the user might actually 291 /* no need to test here if freq_step is zero as the user might actually
313 * want this, they would be crazy though :) */ 292 * want this, they would be crazy though :) */
314 mutex_lock(&dbs_mutex);
315 dbs_tuners_ins.freq_step = input; 293 dbs_tuners_ins.freq_step = input;
316 mutex_unlock(&dbs_mutex);
317
318 return count; 294 return count;
319} 295}
320 296