ia64/linux-2.6.18-xen.hg

annotate lib/cpumask.c @ 0:831230e53067

Import 2.6.18 from kernel.org tarball.
author Ian Campbell <ian.campbell@xensource.com>
date Wed Apr 11 14:15:44 2007 +0100 (2007-04-11)
parents
children
rev   line source
ian@0 1 #include <linux/kernel.h>
ian@0 2 #include <linux/bitops.h>
ian@0 3 #include <linux/cpumask.h>
ian@0 4 #include <linux/module.h>
ian@0 5
ian@0 6 int __first_cpu(const cpumask_t *srcp)
ian@0 7 {
ian@0 8 return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
ian@0 9 }
ian@0 10 EXPORT_SYMBOL(__first_cpu);
ian@0 11
ian@0 12 int __next_cpu(int n, const cpumask_t *srcp)
ian@0 13 {
ian@0 14 return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
ian@0 15 }
ian@0 16 EXPORT_SYMBOL(__next_cpu);
ian@0 17
ian@0 18 /*
ian@0 19 * Find the highest possible smp_processor_id()
ian@0 20 *
ian@0 21 * Note: if we're prepared to assume that cpu_possible_map never changes
ian@0 22 * (reasonable) then this function should cache its return value.
ian@0 23 */
ian@0 24 int highest_possible_processor_id(void)
ian@0 25 {
ian@0 26 unsigned int cpu;
ian@0 27 unsigned highest = 0;
ian@0 28
ian@0 29 for_each_cpu_mask(cpu, cpu_possible_map)
ian@0 30 highest = cpu;
ian@0 31 return highest;
ian@0 32 }
ian@0 33 EXPORT_SYMBOL(highest_possible_processor_id);
ian@0 34
ian@0 35 int __any_online_cpu(const cpumask_t *mask)
ian@0 36 {
ian@0 37 int cpu;
ian@0 38
ian@0 39 for_each_cpu_mask(cpu, *mask) {
ian@0 40 if (cpu_online(cpu))
ian@0 41 break;
ian@0 42 }
ian@0 43 return cpu;
ian@0 44 }
ian@0 45 EXPORT_SYMBOL(__any_online_cpu);