[SSI] openssi/kernel/include/linux dpvproc.h,1.20,1.21

Roger Tsang <[email protected]> Mon, 03 May 2010 06:18:16 +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-serv13556/include/linux

Modified Files:
      Tag: OPENSSI-FC
	dpvproc.h 
Log Message:
VPROC (#ifdef VPROC_RCU_MOVEMENT_LIST):
- Fix rvp_move_abort() doing INIT_LIST_HEAD() could race with find_move_header() and cause move_header structure not found during RCU list traversal.
- Fix mh_datalist race. put_move_data() was using wrong lock for mh_datalist; should use mh_lock.
- move_nodedown_cleanup() to allocate from the stack array of move_header structs to avoid OOM.
- Implement lockless mh_datalist traversal; affects process group / threads migration.
- Avoid movement_list_lock spin lock. Reduce contention.
  - Borrow Linux task->alloc_lock to protect task->execnode.
  - New movement_list_sem semaphore to prevent duplicate entries in movement_list.
- Regression:
  - Hang due to put_move_header() did not release movement_list_lock if lost race with __get_move_header().

VPROC (#ifdef DEBUG):
- mh_magic in move_header structure is for debugging.
- m_magic in move_data structure is for debugging.

VPROC:
- Remove unnecessary memory barriers in dvp_move.c if barriers are already inserted in called functions.
- Fix hang due to calling put_move_data() under mh_lock in move_start_thread(). put_move_data() might acquire mh_lock.
- Remove test for NULL pointer in put_move_header() and put_move_data(). Callers to ensure they don't pass NULL pointer. In existing code most callers won't pass NULL pointer.

 cluster/ssi/vproc/dvp_move.c |  975 ++++++++++++++++++++++-------------
 include/linux/dpvproc.h      |   19 
 2 files changed, 634 insertions(+), 360 deletions(-)


Index: dpvproc.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/linux/dpvproc.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dpvproc.h	17 Dec 2009 05:46:50 -0000	1.20
+++ dpvproc.h	3 May 2010 06:18:14 -0000	1.21
@@ -327,19 +327,24 @@
 struct move_header {
 	struct list_head mh_list;	/* list of headers */
 	struct list_head mh_datalist;	/* move_data entry list:1 per process */
+#ifdef DEBUG
 	u_long mh_magic;
+#endif
+	atomic_t mh_refcnt;		/* ref count for header structure */
+#ifdef VPROC_RCU_MOVEMENT_LIST
+	atomic_t mh_abort;		/* 1:aborting migration */
+#endif
 	int mh_type;
 	pid_t mh_id;
 	clusternode_t mh_ctlnode;	/* Controlling node */
 	clusternode_t mh_dstnode;	/* Destination */
+	spinlock_t mh_lock;
 	int mh_total;			/* total # of processes */
 	int mh_done;			/* # of processes done with operation */
 	int mh_wanted;			/* # of processes done */
 	enum move_state mh_state;	/* overall state */
 	int mh_error;
-	atomic_t mh_refcnt;		/* ref count for header structure */
 	struct semaphore mh_sync_done;	/* synchronous wait */
-	spinlock_t mh_lock;
 	char mh_timeout;
 	char mh_aborting;
 	wait_queue_head_t mh_wqh;
@@ -350,21 +355,25 @@
 
 struct move_data {
 	struct list_head m_list;
+#ifdef DEBUG
 	u_long m_magic;
+#endif
+	atomic_t m_refcnt;
 	pid_t m_pid;
 	pid_t m_leader;
 	struct list_head m_threadlist;
 	struct rvp_remote_args *m_migargs;
 	enum move_state m_state;
-	atomic_t m_refcnt;
 	char m_seen;
 	wait_queue_head_t m_wqh;
 	struct move_header *m_mhp;
 	struct task_struct *m_taskp;
+#ifdef VPROC_RCU_MOVEMENT_LIST
+	atomic_t m_hashed;		/* 0: not in mh_datalist */
+	struct rcu_head m_rcu;
+#endif
 };
 
-extern struct move_header *find_move_header(pid_t pid, int);
-extern void put_move_header(struct move_header *);
 extern int setup_stress_mig(struct task_struct *, long, int);
 extern int setup_execnode_move(struct task_struct *, int, int);
 extern int move_start_thread(pid_t, struct rvp_remote_args *, pid_t);


------------------------------------------------------------------------------