Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2010 00:46:19 +0000 (UTC)
From:      Lawrence Stewart <lstewart@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r210273 - stable/8/sys/sys
Message-ID:  <201007200046.o6K0kJOo034901@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007200046.o6K0kJOo034901>