aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorLawrence Stewart <lstewart@FreeBSD.org>2010-07-13 06:49:34 +0000
committerLawrence Stewart <lstewart@FreeBSD.org>2010-07-13 06:49:34 +0000
commit07de7d5fb59935e366f12c29d5901045c0c964c8 (patch)
tree1d8222351cedc9c246ead8fd3e83284e2741bd76 /sys/sys/pcpu.h
parentb6ef82a03bccdcc5dd20db91b36511871904929d (diff)
downloadsrc-07de7d5fb59935e366f12c29d5901045c0c964c8.tar.gz
src-07de7d5fb59935e366f12c29d5901045c0c964c8.zip
- 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
Notes
Notes: svn path=/head/; revision=209978
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 ea4befb3369f..c157807ed5df 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; \