Commit ddc9b34c authored by Linus Torvalds's avatar Linus Torvalds

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
parents 8e500ff8 fd187aaf
...@@ -1113,6 +1113,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1113,6 +1113,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
unsigned int cpu = sys_dev->id; unsigned int cpu = sys_dev->id;
unsigned long flags; unsigned long flags;
struct cpufreq_policy *data; struct cpufreq_policy *data;
struct kobject *kobj;
struct completion *cmp;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct sys_device *cpu_sys_dev; struct sys_device *cpu_sys_dev;
unsigned int j; unsigned int j;
...@@ -1141,10 +1143,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1141,10 +1143,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
dprintk("removing link\n"); dprintk("removing link\n");
cpumask_clear_cpu(cpu, data->cpus); cpumask_clear_cpu(cpu, data->cpus);
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
sysfs_remove_link(&sys_dev->kobj, "cpufreq"); kobj = &sys_dev->kobj;
cpufreq_cpu_put(data); cpufreq_cpu_put(data);
cpufreq_debug_enable_ratelimit(); cpufreq_debug_enable_ratelimit();
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
sysfs_remove_link(kobj, "cpufreq");
return 0; return 0;
} }
#endif #endif
...@@ -1181,7 +1184,10 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1181,7 +1184,10 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
data->governor->name, CPUFREQ_NAME_LEN); data->governor->name, CPUFREQ_NAME_LEN);
#endif #endif
cpu_sys_dev = get_cpu_sysdev(j); cpu_sys_dev = get_cpu_sysdev(j);
sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); kobj = &cpu_sys_dev->kobj;
unlock_policy_rwsem_write(cpu);
sysfs_remove_link(kobj, "cpufreq");
lock_policy_rwsem_write(cpu);
cpufreq_cpu_put(data); cpufreq_cpu_put(data);
} }
} }
...@@ -1192,19 +1198,22 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) ...@@ -1192,19 +1198,22 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
if (cpufreq_driver->target) if (cpufreq_driver->target)
__cpufreq_governor(data, CPUFREQ_GOV_STOP); __cpufreq_governor(data, CPUFREQ_GOV_STOP);
kobject_put(&data->kobj); kobj = &data->kobj;
cmp = &data->kobj_unregister;
unlock_policy_rwsem_write(cpu);
kobject_put(kobj);
/* we need to make sure that the underlying kobj is actually /* we need to make sure that the underlying kobj is actually
* not referenced anymore by anybody before we proceed with * not referenced anymore by anybody before we proceed with
* unloading. * unloading.
*/ */
dprintk("waiting for dropping of refcount\n"); dprintk("waiting for dropping of refcount\n");
wait_for_completion(&data->kobj_unregister); wait_for_completion(cmp);
dprintk("wait complete\n"); dprintk("wait complete\n");
lock_policy_rwsem_write(cpu);
if (cpufreq_driver->exit) if (cpufreq_driver->exit)
cpufreq_driver->exit(data); cpufreq_driver->exit(data);
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
free_cpumask_var(data->related_cpus); free_cpumask_var(data->related_cpus);
......
...@@ -444,6 +444,7 @@ static struct attribute_group dbs_attr_group_old = { ...@@ -444,6 +444,7 @@ static struct attribute_group dbs_attr_group_old = {
static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
{ {
unsigned int load = 0; unsigned int load = 0;
unsigned int max_load = 0;
unsigned int freq_target; unsigned int freq_target;
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
...@@ -501,6 +502,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) ...@@ -501,6 +502,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
continue; continue;
load = 100 * (wall_time - idle_time) / wall_time; load = 100 * (wall_time - idle_time) / wall_time;
if (load > max_load)
max_load = load;
} }
/* /*
...@@ -511,7 +515,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) ...@@ -511,7 +515,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
return; return;
/* Check for frequency increase */ /* Check for frequency increase */
if (load > dbs_tuners_ins.up_threshold) { if (max_load > dbs_tuners_ins.up_threshold) {
this_dbs_info->down_skip = 0; this_dbs_info->down_skip = 0;
/* if we are already at full speed then break out early */ /* 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,7 +542,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
* can support the current CPU usage without triggering the up * can support the current CPU usage without triggering the up
* policy. To be safe, we focus 10 points under the threshold. * policy. To be safe, we focus 10 points under the threshold.
*/ */
if (load < (dbs_tuners_ins.down_threshold - 10)) { if (max_load < (dbs_tuners_ins.down_threshold - 10)) {
freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
this_dbs_info->requested_freq -= freq_target; this_dbs_info->requested_freq -= freq_target;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment