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

+20 -7
+14 -5
drivers/cpufreq/cpufreq.c
··· 1113 1113 unsigned int cpu = sys_dev->id; 1114 1114 unsigned long flags; 1115 1115 struct cpufreq_policy *data; 1116 + struct kobject *kobj; 1117 + struct completion *cmp; 1116 1118 #ifdef CONFIG_SMP 1117 1119 struct sys_device *cpu_sys_dev; 1118 1120 unsigned int j; ··· 1143 1141 dprintk("removing link\n"); 1144 1142 cpumask_clear_cpu(cpu, data->cpus); 1145 1143 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1146 - sysfs_remove_link(&sys_dev->kobj, "cpufreq"); 1144 + kobj = &sys_dev->kobj; 1147 1145 cpufreq_cpu_put(data); 1148 1146 cpufreq_debug_enable_ratelimit(); 1149 1147 unlock_policy_rwsem_write(cpu); 1148 + sysfs_remove_link(kobj, "cpufreq"); 1150 1149 return 0; 1151 1150 } 1152 1151 #endif ··· 1184 1181 data->governor->name, CPUFREQ_NAME_LEN); 1185 1182 #endif 1186 1183 cpu_sys_dev = get_cpu_sysdev(j); 1187 - sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); 1184 + kobj = &cpu_sys_dev->kobj; 1185 + unlock_policy_rwsem_write(cpu); 1186 + sysfs_remove_link(kobj, "cpufreq"); 1187 + lock_policy_rwsem_write(cpu); 1188 1188 cpufreq_cpu_put(data); 1189 1189 } 1190 1190 } ··· 1198 1192 if (cpufreq_driver->target) 1199 1193 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1200 1194 1201 - kobject_put(&data->kobj); 1195 + kobj = &data->kobj; 1196 + cmp = &data->kobj_unregister; 1197 + unlock_policy_rwsem_write(cpu); 1198 + kobject_put(kobj); 1202 1199 1203 1200 /* we need to make sure that the underlying kobj is actually 1204 1201 * not referenced anymore by anybody before we proceed with 1205 1202 * unloading. 1206 1203 */ 1207 1204 dprintk("waiting for dropping of refcount\n"); 1208 - wait_for_completion(&data->kobj_unregister); 1205 + wait_for_completion(cmp); 1209 1206 dprintk("wait complete\n"); 1210 1207 1208 + lock_policy_rwsem_write(cpu); 1211 1209 if (cpufreq_driver->exit) 1212 1210 cpufreq_driver->exit(data); 1213 - 1214 1211 unlock_policy_rwsem_write(cpu); 1215 1212 1216 1213 free_cpumask_var(data->related_cpus);
+6 -2
drivers/cpufreq/cpufreq_conservative.c
··· 444 444 static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) 445 445 { 446 446 unsigned int load = 0; 447 + unsigned int max_load = 0; 447 448 unsigned int freq_target; 448 449 449 450 struct cpufreq_policy *policy; ··· 502 501 continue; 503 502 504 503 load = 100 * (wall_time - idle_time) / wall_time; 504 + 505 + if (load > max_load) 506 + max_load = load; 505 507 } 506 508 507 509 /* ··· 515 511 return; 516 512 517 513 /* Check for frequency increase */ 518 - if (load > dbs_tuners_ins.up_threshold) { 514 + if (max_load > dbs_tuners_ins.up_threshold) { 519 515 this_dbs_info->down_skip = 0; 520 516 521 517 /* if we are already at full speed then break out early */ ··· 542 538 * can support the current CPU usage without triggering the up 543 539 * policy. To be safe, we focus 10 points under the threshold. 544 540 */ 545 - if (load < (dbs_tuners_ins.down_threshold - 10)) { 541 + if (max_load < (dbs_tuners_ins.down_threshold - 10)) { 546 542 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 547 543 548 544 this_dbs_info->requested_freq -= freq_target;