Merge branch 'pm-cpufreq'
[linux-2.6-microblaze.git] / lib / cpumask.c
index 85da6ab..3592402 100644 (file)
@@ -267,3 +267,21 @@ int cpumask_any_and_distribute(const struct cpumask *src1p,
        return next;
 }
 EXPORT_SYMBOL(cpumask_any_and_distribute);
+
+int cpumask_any_distribute(const struct cpumask *srcp)
+{
+       int next, prev;
+
+       /* NOTE: our first selection will skip 0. */
+       prev = __this_cpu_read(distribute_cpu_mask_prev);
+
+       next = cpumask_next(prev, srcp);
+       if (next >= nr_cpu_ids)
+               next = cpumask_first(srcp);
+
+       if (next < nr_cpu_ids)
+               __this_cpu_write(distribute_cpu_mask_prev, next);
+
+       return next;
+}
+EXPORT_SYMBOL(cpumask_any_distribute);