Skip to content

Commit

Permalink
cpufreq: Clear policy->cpus even for the last CPU
Browse files Browse the repository at this point in the history
We clear policy->cpus mask while CPUs are hotplugged out. We do it for all CPUs
except the last CPU of the policy. I don't remember what the rationale behind
that was, but I couldn't think of anything that will break if we remove this
conditional clearing and always clear policy->cpus.

The benefit we get out of it is, we can know if a policy is active or not by
checking if this field is empty or not. That will be used by later commits.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed May 7, 2015
1 parent bb29ae1 commit 303ae72
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,9 +1430,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,

down_write(&policy->rwsem);
cpus = cpumask_weight(policy->cpus);

if (cpus > 1)
cpumask_clear_cpu(cpu, policy->cpus);
cpumask_clear_cpu(cpu, policy->cpus);
up_write(&policy->rwsem);

/* If cpu is last user of policy, free policy */
Expand Down

0 comments on commit 303ae72

Please sign in to comment.