[SSI] openssi/kernel/cluster/ssi/vproc dvp_move.c,1.21,1.22

Roger Tsang <[email protected]> Wed, 15 Dec 2010 06:58:36 +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-serv12799/kernel/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	dvp_move.c 
Log Message:
- move_start_thread: fix bad test for PM_MIGRATE_IN or PM_MIGRATE_IN_DONE mh_state. bad state of migration was not detected or logged.
- __get_move_header: return 0 or 1 for failure or success to acquire reference to move_header structure. this used to return NULL or a pointer to move_header structure.
- setup_execnode_move: check for move_header's with type MOV_IN to avoid migrating out threads before the rest of the group have finished moving in. add_thread_group() might not see threads that are still migrating in and may result in partial thread group migration. bug affects process group migration as well.


Index: dvp_move.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_move.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- dvp_move.c	15 Dec 2010 06:46:56 -0000	1.21
+++ dvp_move.c	15 Dec 2010 06:58:33 -0000	1.22
@@ -239,22 +239,21 @@
 			       _new_state, __FUNCTION__, __LINE__)
 
 #ifdef VPROC_RCU_MOVEMENT_LIST
-static inline struct move_header *
+static inline int
 __get_move_header(struct move_header *h)
 {
 #ifdef DEBUG
 	spin_lock(&h->mh_lock);
 	if (!h->mh_magic) {
 		spin_unlock(&h->mh_lock);
-		return NULL;
+		return 0;
 	}
 	atomic_inc(&h->mh_refcnt);
 	spin_unlock(&h->mh_lock);
+	return 1;
 #else
-	if (!atomic_test_and_add(1, &h->mh_refcnt))
-		return NULL;
+	return atomic_test_and_add(1, &h->mh_refcnt);
 #endif /* !DEBUG */
-	return h;
 }
 #endif /* !VPROC_RCU_MOVEMENT_LIST */
 
@@ -616,10 +615,11 @@
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(h, &movement_list, mh_list) {
-		if (h->mh_id == id && (h->mh_type & type)) {
-			h = __get_move_header(h);
-			goto out;
-		}
+		if (!(h->mh_id == id && (h->mh_type & type)))
+			continue;
+		if (!__get_move_header(h))
+			continue;
+		goto out;
 	}
 	h = NULL;
 out:
@@ -1784,7 +1784,7 @@
 	/* Check if entry already exists */
 #ifdef VPROC_RCU_MOVEMENT_LIST
 	down(&movement_list_sem);
-	h_old = find_move_header(id, MOV_OUT);
+	h_old = find_move_header(id, MOV_IN | MOV_OUT);
 	if (h_old) {
 		up(&movement_list_sem);
 		put_move_header(h_old);
@@ -1797,7 +1797,7 @@
 	up(&movement_list_sem);
 #else /* VPROC_RCU_MOVEMENT_LIST */
 	spin_lock(&movement_list_lock);
-	h_old = __find_move_header(id, MOV_OUT);
+	h_old = __find_move_header(id, MOV_IN | MOV_OUT);
 	if (h_old) {
 		spin_unlock(&movement_list_lock);
 		put_move_header(h_old);
@@ -1909,7 +1909,7 @@
 	if (state == PM_QUIESCED) {
 		h->mh_done = 0;
 		h->mh_wanted = 0;
-	} else if (state != PM_MIGRATE_IN && state != PM_MIGRATE_IN_DONE) {
+	} else if (state != PM_MIGRATE_IN || state != PM_MIGRATE_IN_DONE) {
 		spin_unlock(&h->mh_lock);
 		if (state != PM_ABORT)
 			printk(KERN_WARNING


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d