summaryrefslogtreecommitdiffstats
path: root/sys/sys/_cpuset.h
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2013-05-09 00:04:59 +0000
committerattilio <attilio@FreeBSD.org>2013-05-09 00:04:59 +0000
commit73f26a621eb595dd18b96f21bae3927a684868a8 (patch)
tree7b5335c94e9099d51a94cf3dbfce719c16a21958 /sys/sys/_cpuset.h
parentdefb13707d01a88b7e838ef2d83d5e3dd39cdf83 (diff)
downloadFreeBSD-src-73f26a621eb595dd18b96f21bae3927a684868a8.zip
FreeBSD-src-73f26a621eb595dd18b96f21bae3927a684868a8.tar.gz
Generalize the bitset operations, present in cpuset and offer a KPI to
redefine such operations for different consumers. This will be used when NUMA support will be finished and numaset will need to be used. Sponsored by: EMC / Isilon storage division Obtained from: jeff Reviewed by: alc
Diffstat (limited to 'sys/sys/_cpuset.h')
-rw-r--r--sys/sys/_cpuset.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/sys/_cpuset.h b/sys/sys/_cpuset.h
index a11c0f0..a488700 100644
--- a/sys/sys/_cpuset.h
+++ b/sys/sys/_cpuset.h
@@ -32,6 +32,8 @@
#ifndef _SYS__CPUSET_H_
#define _SYS__CPUSET_H_
+#include <sys/_bitset.h>
+
#ifdef _KERNEL
#define CPU_SETSIZE MAXCPU
#endif
@@ -42,17 +44,13 @@
#define CPU_SETSIZE CPU_MAXSIZE
#endif
-#define _NCPUBITS (sizeof(long) * NBBY) /* bits per mask */
-#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
-
-typedef struct _cpuset {
- long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
-} cpuset_t;
+#define _NCPUBITS _BITSET_BITS
+#define _NCPUWORDS __bitset_words(CPU_SETSIZE)
-#define CPUSET_FSET \
- [ 0 ... (_NCPUWORDS - 1) ] = (-1L)
+BITSET_DEFINE(_cpuset, CPU_SETSIZE);
+typedef struct _cpuset cpuset_t;
-#define CPUSET_T_INITIALIZER(x) \
- { .__bits = { x } }
+#define CPUSET_FSET BITSET_FSET(_NCPUWORDS)
+#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER
#endif /* !_SYS__CPUSET_H_ */
OpenPOWER on IntegriCloud