lkml.org 
[lkml]   [2008]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 06/31] cpumask: new lib/cpumask.c
Signed-of-by: Mike Travis <travis@sgi.com>
---
lib/cpumask.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)

--- struct-cpumasks.orig/lib/cpumask.c
+++ struct-cpumasks/lib/cpumask.c
@@ -3,34 +3,40 @@
#include <linux/cpumask.h>
#include <linux/module.h>

-int __first_cpu(const cpumask_t *srcp)
+int cpus_first(const_cpumask_t srcp)
{
- return find_first_bit(srcp->bits, NR_CPUS);
+ return find_first_bit(srcp->bits, nr_cpu_ids);
}
-EXPORT_SYMBOL(__first_cpu);
+EXPORT_SYMBOL(cpus_first);

-int __next_cpu(int n, const cpumask_t *srcp)
+int cpus_next(int n, const_cpumask_t srcp)
{
- return find_next_bit(srcp->bits, NR_CPUS, n+1);
+ return find_next_bit(srcp->bits, nr_cpu_ids, n+1);
}
-EXPORT_SYMBOL(__next_cpu);
+EXPORT_SYMBOL(cpus_next);

-#if NR_CPUS > 64
-int __next_cpu_nr(int n, const cpumask_t *srcp)
+int cpus_next_in(int n, const_cpumask_t srcp, const_cpumask_t andp)
{
- return find_next_bit(srcp->bits, nr_cpu_ids, n+1);
+ int cpu;
+
+ for (cpu = n + 1; cpu < nr_cpu_ids; cpu++) {
+ cpu = find_next_bit(srcp->bits, nr_cpu_ids, cpu);
+
+ if (cpu < nr_cpu_ids && cpu_isset(cpu, andp))
+ return cpu;
+ }
+ return nr_cpu_ids;
}
-EXPORT_SYMBOL(__next_cpu_nr);
-#endif
+EXPORT_SYMBOL(cpus_next_in);

-int __any_online_cpu(const cpumask_t *mask)
+int any_cpu_in(const_cpumask_t mask, const_cpumask_t andmask)
{
int cpu;

- for_each_cpu_mask(cpu, *mask) {
- if (cpu_online(cpu))
+ for_each_cpu(cpu, mask) {
+ if (cpu_isset(cpu, andmask))
break;
}
return cpu;
}
-EXPORT_SYMBOL(__any_online_cpu);
+EXPORT_SYMBOL(any_cpu_in);
--


\
 
 \ /
  Last update: 2008-09-29 20:07    [W:0.188 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site