Преглед на файлове

[CPUFREQ] Don't take semaphore in cpufreq_quick_get()

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>
Andi Kleen преди 17 години
родител
ревизия
9eb59573d4
променени са 1 файла, в които са добавени 0 реда и са изтрити 5 реда
  1. 0 5
      drivers/cpufreq/cpufreq.c

+ 0 - 5
drivers/cpufreq/cpufreq.c

@@ -1111,12 +1111,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
 	unsigned int ret_freq = 0;
 	unsigned int ret_freq = 0;
 
 
 	if (policy) {
 	if (policy) {
-		if (unlikely(lock_policy_rwsem_read(cpu)))
-			return ret_freq;
-
 		ret_freq = policy->cur;
 		ret_freq = policy->cur;
-
-		unlock_policy_rwsem_read(cpu);
 		cpufreq_cpu_put(policy);
 		cpufreq_cpu_put(policy);
 	}
 	}