aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-24 14:35:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-24 14:35:21 -0400
commitddc9b34c3b3bc063a7d9eb891ae09b8f49cfb27e (patch)
treee28d67d3872dce2516c039ccad08fabff076cead /drivers/cpufreq
parent8e500ff8df1223dfb42d6c39d3de1fc216fba1a2 (diff)
parentfd187aaf980c45f1d16a94a846faa68e24de03c8 (diff)
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: [CPUFREQ] use max load in conservative governor [CPUFREQ] fix a lockdep warning
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c19
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c8
2 files changed, 20 insertions, 7 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 2d5d575e889d..75d293eeb3ee 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1113,6 +1113,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1113 unsigned int cpu = sys_dev->id; 1113 unsigned int cpu = sys_dev->id;
1114 unsigned long flags; 1114 unsigned long flags;
1115 struct cpufreq_policy *data; 1115 struct cpufreq_policy *data;
1116 struct kobject *kobj;
1117 struct completion *cmp;
1116#ifdef CONFIG_SMP 1118#ifdef CONFIG_SMP
1117 struct sys_device *cpu_sys_dev; 1119 struct sys_device *cpu_sys_dev;
1118 unsigned int j; 1120 unsigned int j;
@@ -1141,10 +1143,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1141 dprintk("removing link\n"); 1143 dprintk("removing link\n");
1142 cpumask_clear_cpu(cpu, data->cpus); 1144 cpumask_clear_cpu(cpu, data->cpus);
1143 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1145 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1144 sysfs_remove_link(&sys_dev->kobj, "cpufreq"); 1146 kobj = &sys_dev->kobj;
1145 cpufreq_cpu_put(data); 1147 cpufreq_cpu_put(data);
1146 cpufreq_debug_enable_ratelimit(); 1148 cpufreq_debug_enable_ratelimit();
1147 unlock_policy_rwsem_write(cpu); 1149 unlock_policy_rwsem_write(cpu);
1150 sysfs_remove_link(kobj, "cpufreq");
1148 return 0; 1151 return 0;
1149 } 1152 }
1150#endif 1153#endif
@@ -1181,7 +1184,10 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1181 data->governor->name, CPUFREQ_NAME_LEN); 1184 data->governor->name, CPUFREQ_NAME_LEN);
1182#endif 1185#endif
1183 cpu_sys_dev = get_cpu_sysdev(j); 1186 cpu_sys_dev = get_cpu_sysdev(j);
1184 sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); 1187 kobj = &cpu_sys_dev->kobj;
1188 unlock_policy_rwsem_write(cpu);
1189 sysfs_remove_link(kobj, "cpufreq");
1190 lock_policy_rwsem_write(cpu);
1185 cpufreq_cpu_put(data); 1191 cpufreq_cpu_put(data);
1186 } 1192 }
1187 } 1193 }
@@ -1192,19 +1198,22 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1192 if (cpufreq_driver->target) 1198 if (cpufreq_driver->target)
1193 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1199 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1194 1200
1195 kobject_put(&data->kobj); 1201 kobj = &data->kobj;
1202 cmp = &data->kobj_unregister;
1203 unlock_policy_rwsem_write(cpu);
1204 kobject_put(kobj);
1196 1205
1197 /* we need to make sure that the underlying kobj is actually 1206 /* we need to make sure that the underlying kobj is actually
1198 * not referenced anymore by anybody before we proceed with 1207 * not referenced anymore by anybody before we proceed with
1199 * unloading. 1208 * unloading.
1200 */ 1209 */
1201 dprintk("waiting for dropping of refcount\n"); 1210 dprintk("waiting for dropping of refcount\n");
1202 wait_for_completion(&data->kobj_unregister); 1211 wait_for_completion(cmp);
1203 dprintk("wait complete\n"); 1212 dprintk("wait complete\n");
1204 1213
1214 lock_policy_rwsem_write(cpu);
1205 if (cpufreq_driver->exit) 1215 if (cpufreq_driver->exit)
1206 cpufreq_driver->exit(data); 1216 cpufreq_driver->exit(data);
1207
1208 unlock_policy_rwsem_write(cpu); 1217 unlock_policy_rwsem_write(cpu);
1209 1218
1210 free_cpumask_var(data->related_cpus); 1219 free_cpumask_var(data->related_cpus);
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 599a40b25cb0..3a147874a465 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -444,6 +444,7 @@ static struct attribute_group dbs_attr_group_old = {
444static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) 444static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
445{ 445{
446 unsigned int load = 0; 446 unsigned int load = 0;
447 unsigned int max_load = 0;
447 unsigned int freq_target; 448 unsigned int freq_target;
448 449
449 struct cpufreq_policy *policy; 450 struct cpufreq_policy *policy;
@@ -501,6 +502,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
501 continue; 502 continue;
502 503
503 load = 100 * (wall_time - idle_time) / wall_time; 504 load = 100 * (wall_time - idle_time) / wall_time;
505
506 if (load > max_load)
507 max_load = load;
504 } 508 }
505 509
506 /* 510 /*
@@ -511,7 +515,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
511 return; 515 return;
512 516
513 /* Check for frequency increase */ 517 /* Check for frequency increase */
514 if (load > dbs_tuners_ins.up_threshold) { 518 if (max_load > dbs_tuners_ins.up_threshold) {
515 this_dbs_info->down_skip = 0; 519 this_dbs_info->down_skip = 0;
516 520
517 /* if we are already at full speed then break out early */ 521 /* if we are already at full speed then break out early */
@@ -538,7 +542,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
538 * can support the current CPU usage without triggering the up 542 * can support the current CPU usage without triggering the up
539 * policy. To be safe, we focus 10 points under the threshold. 543 * policy. To be safe, we focus 10 points under the threshold.
540 */ 544 */
541 if (load < (dbs_tuners_ins.down_threshold - 10)) { 545 if (max_load < (dbs_tuners_ins.down_threshold - 10)) {
542 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 546 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
543 547
544 this_dbs_info->requested_freq -= freq_target; 548 this_dbs_info->requested_freq -= freq_target;