summaryrefslogtreecommitdiffstats
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2010-07-13 06:49:34 +0000
committerlstewart <lstewart@FreeBSD.org>2010-07-13 06:49:34 +0000
commit1330aa034b7f382975340f817ff6564f5f4eae8d (patch)
tree1d8222351cedc9c246ead8fd3e83284e2741bd76 /sys/sys/pcpu.h
parentbc9554cce6ad9c32fb43ea7772ff1c42c04bdcbc (diff)
downloadFreeBSD-src-1330aa034b7f382975340f817ff6564f5f4eae8d.zip
FreeBSD-src-1330aa034b7f382975340f817ff6564f5f4eae8d.tar.gz
- Rename DPCPU_SUM to DPCPU_VARSUM to better reflect the fact it operates on
member variables of a DPCPU struct. - Add DPCPU_SUM which sums a DPCPU variable. Sponsored by: FreeBSD Foundation MFC after: 3 days
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index ea4befb..c157807 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -109,7 +109,19 @@ extern uintptr_t dpcpu_off[];
/*
* Utility macros.
*/
-#define DPCPU_SUM(n, var) __extension__ \
+#define DPCPU_SUM(n) __extension__ \
+({ \
+ u_int _i; \
+ __typeof(DPCPU_PTR(n)) sum; \
+ \
+ sum = 0; \
+ CPU_FOREACH(_i) { \
+ sum += DPCPU_ID_PTR(_i, n); \
+ } \
+ sum; \
+})
+
+#define DPCPU_VARSUM(n, var) __extension__ \
({ \
u_int _i; \
__typeof((DPCPU_PTR(n))->var) sum; \
OpenPOWER on IntegriCloud