[SSI] openssi/kernel/cluster/ssi/vproc dvp_move.c,1.16,1.17

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/cluster/ssi/vproc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv13556/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	dvp_move.c 
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: dvp_move.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_move.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dvp_move.c	2 Nov 2009 03:45:33 -0000	1.16
+++ dvp_move.c	3 May 2010 06:18:14 -0000	1.17
@@ -37,24 +37,39 @@
 
 static LIST_HEAD(movement_list);
 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(movement_list_lock);
+#ifdef VPROC_RCU_MOVEMENT_LIST
+static DECLARE_MUTEX(movement_list_sem);
+#endif
 /* Lock ordering:
- *	movement_list_lock
- *	mh_lock
+ *	movement_list_sem
+ *	-> movement_list_lock
[...1677 lines suppressed...]
-			move_in_continue(h, 1);
-		put_move_header(h);
-	}
+		rcu_read_unlock();
 
-	kfree(down_list);
-#else
+		for (count=0; count < ind; count++) {
+			h = down_list[count];
+			if (h->mh_type & MOV_OUT)
+				move_out_nodedown(h);
+			else
+				move_in_continue(h, 1);
+			put_move_header(h);
+		}
+	} while (retry);
+#else /* VPROC_RCU_MOVEMENT_LIST */
 	struct move_header *h, *next;
 	LIST_HEAD(down_list);
 


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