[PATCH] cpufreq: SMP fix for conservative governor
authorDave Jones <davej@redhat.com>
Thu, 27 Oct 2005 23:16:25 +0000 (16:16 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 27 Oct 2005 23:29:24 +0000 (16:29 -0700)
Don't try to access not-present CPUs.  Conservative governor will always
oops on SMP without this fix.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=4781

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/cpufreq/cpufreq_conservative.c

index e1df376e709ea0681c0498e1cc5c548764748cab..2ed5c4363b536220843d942af2e84276b9a1dbd0 100644 (file)
@@ -315,9 +315,9 @@ static void dbs_check_cpu(int cpu)
        policy = this_dbs_info->cur_policy;
 
        if ( init_flag == 0 ) {
-               for ( /* NULL */; init_flag < NR_CPUS; init_flag++ ) {
-                       dbs_info = &per_cpu(cpu_dbs_info, init_flag);
-                       requested_freq[cpu] = dbs_info->cur_policy->cur;
+               for_each_online_cpu(j) {
+                       dbs_info = &per_cpu(cpu_dbs_info, j);
+                       requested_freq[j] = dbs_info->cur_policy->cur;
                }
                init_flag = 1;
        }