[SSI] openssi/kernel/include/linux vproc.h,1.28,1.29

Roger Tsang <[email protected]> Fri, 05 Mar 2010 05:59:08 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/include/linux
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1181/kernel/include/linux

Modified Files:
      Tag: OPENSSI-FC
	vproc.h 
Log Message:
VPROC (#ifdef TASK_HOLD_VPROC):
- Remove vp_lock spinlock in vproc struct. Use atomic_test_and_add().

VPROC (#ifdef VPROC_DEBUG):
- vp_magic checking is for debugging; no longer done in production code.

 cluster/ssi/vproc/vp_debug.c |    2 
 cluster/ssi/vproc/vp_subr.c  |   95 +++++++++++++++++++----------------
 include/linux/vproc.h        |   23 ++++++--
 3 files changed, 73 insertions(+), 47 deletions(-)


Index: vproc.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/linux/vproc.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- vproc.h	17 Dec 2009 05:46:50 -0000	1.28
+++ vproc.h	5 Mar 2010 05:59:06 -0000	1.29
@@ -50,7 +50,6 @@
 	SPIN_LOCK_T  	  vp_ref_cnt_lock; /* lock for reference counting */
 #else
 	atomic_t	  vp_ref_cnt;	/* vproc usage count */
-	SPIN_LOCK_T	  vp_lock; 	/* lock for vp_magic */
 #ifdef VPROC_RCU_LIST
 	struct rcu_head	  vp_rcu;	/* callback structure for RCU */
 #ifdef VPROC_LIST_SPINLOCK
@@ -58,17 +57,20 @@
 #endif
 #endif
 #endif /* ATOMIC_VPROC_REFCNT */
-	int		  vp_magic;	/* magic number id for vproc */
-#define			  VP_MAGIC	0x63727076
 #ifdef TASK_HOLD_VPROC
 	int		  vp_relse;	/* coordinate vproc de-alloc */
 #define			  VP_GIVEBACK	0xBABECAFE
 #define			  VP_DEAD	0xBBADF00D
 #endif
-#ifdef	VPROC_DEBUG
+#ifdef VPROC_DEBUG
+#ifdef TASK_HOLD_VPROC
+	SPIN_LOCK_T	  vp_lock; 	/* lock for vp_magic */
+	int		  vp_magic;	/* magic number id for vproc */
+#define			  VP_MAGIC	0x63727076
+#endif
 	unsigned long	  vp_index;	/* vproc index number */
 	struct vproc	  *vp_next;	/* static link to next vproc */
-#endif
+#endif /* VPROC_DEBUG */
 };
 #ifndef VPROC_HASH_LIST
 #define	vp_hashfwd	vp_pid_hash.hashfwd
@@ -142,7 +144,16 @@
 #define VPROCPTR_NOHOLD(pid)	vprocptr(pid, 0)
 #endif
 #endif /* VPROC_RCU_LIST */
-#define VP_HASHED(v)	((v)->vp_magic == VP_MAGIC)
+
+#if defined(TASK_HOLD_VPROC) && defined(VPROC_DEBUG)
+#define VP_HASHED(_v)	((_v)->vp_magic == VP_MAGIC)
+#else
+#ifdef ATOMIC_VPROC_REFCNT
+#define VP_HASHED(_v)	(atomic_read(&(_v)->vp_ref_cnt))
+#else
+#define VP_HASHED(_v)	((_v)->vp_ref_cnt > 0)
+#endif
+#endif /* !defined(TASK_HOLD_VPROC) || !defined(VPROC_DEBUG) */
 
 /* LOCATE_VPROC_PID() option flags */
 #define LVP_NOLOCK	0x01


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev