diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-10-27 11:03:26 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-10-27 11:03:26 +1100 |
commit | 7bbb6abc51f984d5228dd06909099319474cf024 (patch) | |
tree | c2223de06e61ac7564e72c815d00e76087d98ab7 /lib | |
parent | c474b0b1305e91e4533e44cfc4844470887df72f (diff) |
cpumask:cpumask_any_but
There's a common case where we want any online cpu except a particular
one. This creates a helper to do that, otherwise we need a temp var
and cpumask_andnot().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpumask.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/cpumask.c b/lib/cpumask.c index 007e8404dc33..4795e69e5b63 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -24,6 +24,16 @@ int cpumask_next_and(int n, const cpumask_t *srcp, const cpumask_t *andp) } EXPORT_SYMBOL(cpumask_next_and); +int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) +{ + unsigned int i; + + for_each_cpu(i, mask) + if (i != cpu) + break; + return i; +} + /* These are not inline because of header tangles. */ #ifdef CONFIG_CPUMASK_OFFSTACK bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) |