Skip to content

Commit

Permalink
[CPUFREQ] Don't take semaphore in cpufreq_quick_get()
Browse files Browse the repository at this point in the history
I don't see any reason to take an expensive lock in cpufreq_quick_get()
Reading policy->cur is a single atomic operation and after
the lock is dropped again the state could change any time anyways.

So don't take the lock in the first place.

This also makes this function interrupt safe which is useful
for some code of mine.

Signed-off-by: Andi Kleen <ak@suse.de>
Cc: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
  • Loading branch information
Andi Kleen authored and Dave Jones committed Oct 10, 2007
1 parent 562d94d commit 9eb5957
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,12 +1111,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
unsigned int ret_freq = 0;

if (policy) {
if (unlikely(lock_policy_rwsem_read(cpu)))
return ret_freq;

ret_freq = policy->cur;

unlock_policy_rwsem_read(cpu);
cpufreq_cpu_put(policy);
}

Expand Down

0 comments on commit 9eb5957

Please sign in to comment.