svn commit: r210273 - stable/8/sys/sys
Lawrence Stewart
lstewart at FreeBSD.org
Tue Jul 20 00:46:19 UTC 2010
Author: lstewart
Date: Tue Jul 20 00:46:18 2010
New Revision: 210273
URL: http://svn.freebsd.org/changeset/base/210273
Log:
MFC r209978,209981,209987,210184:
- Rename DPCPU_SUM to DPCPU_VARSUM to better reflect the fact it operates on
member variables of a DPCPU struct (r209978).
- Add DPCPU_SUM which sums a DPCPU variable (r209978,209987,210184).
- Macro to simplify zeroing DPCPU variables (r209981,209987).
Sponsored by: FreeBSD Foundation
Modified:
stable/8/sys/sys/pcpu.h
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/sys/pcpu.h
==============================================================================
--- stable/8/sys/sys/pcpu.h Tue Jul 20 00:32:11 2010 (r210272)
+++ stable/8/sys/sys/pcpu.h Tue Jul 20 00:46:18 2010 (r210273)
@@ -112,7 +112,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; \
@@ -124,6 +136,14 @@ extern uintptr_t dpcpu_off[];
sum; \
})
+#define DPCPU_ZERO(n) do { \
+ u_int _i; \
+ \
+ CPU_FOREACH(_i) { \
+ bzero(DPCPU_ID_PTR(_i, n), sizeof(*DPCPU_PTR(n))); \
+ } \
+} while(0)
+
/*
* XXXUPS remove as soon as we have per cpu variable
* linker sets and can define rm_queue in _rm_lock.h
More information about the svn-src-stable-8
mailing list