[Cbe-oss-dev] Gang scheduling [RFC] [PATCH 7:9] dynamic size of gang

Luke Browning lukebr at linux.vnet.ibm.com
Sat Mar 15 08:00:01 EST 2008


Allow gang to grow in size after it has been started

Just deactivate it, add the new context, and let the calling thread
drives its reactivation.  It needs to be unscheduled, since it may
no longer fit or it may need to be migrated to a different node.

Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>

---

Index: public_git/arch/powerpc/platforms/cell/spufs/context.c
===================================================================
--- public_git.orig/arch/powerpc/platforms/cell/spufs/context.c	2008-03-14 14:05:24.000000000 -0300
+++ public_git/arch/powerpc/platforms/cell/spufs/context.c	2008-03-14 14:05:39.000000000 -0300
@@ -57,6 +57,17 @@
 	if (spu_init_csa(&ctx->csa))
 		goto out_free_gang;
 
+	/* If the gang is running, it needs to be stopped, since we have a
+	 * new context that needs to be gang scheduled.  Gangs are allowed
+	 * to grow and shrink over time, but they are unscheduled when it
+	 * happens as the gang may need to migrated to a different node.
+	 */
+	if (atomic_read(&gang->nstarted)) {
+		mutex_lock(&gang->mutex);
+		spu_deactivate(gang);
+		mutex_unlock(&gang->mutex);
+	}
+
 	spin_lock_init(&ctx->mmio_lock);
 	mutex_init(&ctx->mapping_lock);
 	kref_init(&ctx->kref);





More information about the cbe-oss-dev mailing list