Author: lstewart
Date: Tue Jul 13 06:49:34 2010
New Revision: 209978
URL: http://svn.freebsd.org/changeset/base/209978

Log:
  - 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

Modified:
  head/sys/sys/pcpu.h

Modified: head/sys/sys/pcpu.h
==============================================================================
--- head/sys/sys/pcpu.h Tue Jul 13 06:42:47 2010        (r209977)
+++ head/sys/sys/pcpu.h Tue Jul 13 06:49:34 2010        (r209978)
@@ -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;                              \
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to