ia64/linux-2.6.18-xen.hg

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/cpumask.c	Wed Apr 11 14:15:44 2007 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +#include <linux/kernel.h>
     1.5 +#include <linux/bitops.h>
     1.6 +#include <linux/cpumask.h>
     1.7 +#include <linux/module.h>
     1.8 +
     1.9 +int __first_cpu(const cpumask_t *srcp)
    1.10 +{
    1.11 +	return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
    1.12 +}
    1.13 +EXPORT_SYMBOL(__first_cpu);
    1.14 +
    1.15 +int __next_cpu(int n, const cpumask_t *srcp)
    1.16 +{
    1.17 +	return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
    1.18 +}
    1.19 +EXPORT_SYMBOL(__next_cpu);
    1.20 +
    1.21 +/*
    1.22 + * Find the highest possible smp_processor_id()
    1.23 + *
    1.24 + * Note: if we're prepared to assume that cpu_possible_map never changes
    1.25 + * (reasonable) then this function should cache its return value.
    1.26 + */
    1.27 +int highest_possible_processor_id(void)
    1.28 +{
    1.29 +	unsigned int cpu;
    1.30 +	unsigned highest = 0;
    1.31 +
    1.32 +	for_each_cpu_mask(cpu, cpu_possible_map)
    1.33 +		highest = cpu;
    1.34 +	return highest;
    1.35 +}
    1.36 +EXPORT_SYMBOL(highest_possible_processor_id);
    1.37 +
    1.38 +int __any_online_cpu(const cpumask_t *mask)
    1.39 +{
    1.40 +	int cpu;
    1.41 +
    1.42 +	for_each_cpu_mask(cpu, *mask) {
    1.43 +		if (cpu_online(cpu))
    1.44 +			break;
    1.45 +	}
    1.46 +	return cpu;
    1.47 +}
    1.48 +EXPORT_SYMBOL(__any_online_cpu);