[Cbe-oss-dev] [PATCH 8/10] spu sched: move prio from spu into spu_context

Christoph Hellwig hch at lst.de
Mon Jan 8 09:15:26 EST 2007


It doesn't make any sense to have a priority field in the physical spu
structure.  Move it into the spu context instead.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6/arch/powerpc/platforms/cell/spufs/context.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/context.c	2007-01-03 21:13:05.000000000 +0100
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/context.c	2007-01-03 21:13:48.000000000 +0100
@@ -53,6 +53,7 @@
 	ctx->owner = get_task_mm(current);
 	if (gang)
 		spu_gang_add_ctx(gang, ctx);
+	ctx->prio = current->prio;
 	goto out;
 out_free:
 	kfree(ctx);
@@ -172,8 +173,7 @@
 		ret = spu_activate(ctx, 0);
 		if (ret)
 			goto out_unlock;
-	} else
-		ctx->spu->prio = current->prio;
+	}
 
 	return 0;
 
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/sched.c	2007-01-03 21:13:05.000000000 +0100
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c	2007-01-03 21:13:48.000000000 +0100
@@ -145,7 +145,6 @@
 	ctx->spu = spu;
 	ctx->ops = &spu_hw_ops;
 	spu->pid = current->pid;
-	spu->prio = current->prio;
 	spu->mm = ctx->owner;
 	mm_needs_global_tlbie(spu->mm);
 	spu->ibox_callback = spufs_ibox_callback;
@@ -189,7 +188,6 @@
 	spu->dma_callback = NULL;
 	spu->mm = NULL;
 	spu->pid = 0;
-	spu->prio = MAX_PRIO;
 	ctx->ops = &spu_backing_ops;
 	ctx->spu = NULL;
 	spu->flags = 0;
@@ -223,7 +221,7 @@
 
 static void spu_prio_wait(struct spu_context *ctx, u64 flags)
 {
-	int prio = current->prio;
+	int prio = ctx->prio;
 	wait_queue_head_t *wq = &spu_prio->waitq[prio];
 	DEFINE_WAIT(wait);
 
@@ -342,8 +340,6 @@
 					 __FUNCTION__, spu->number, spu->node);
 				spu_deactivate(ctx);
 				need_yield = 1;
-			} else {
-				spu->prio = MAX_PRIO;
 			}
 		}
 		mutex_unlock(&ctx->state_mutex);
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/spufs.h
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/spufs.h	2007-01-03 21:13:47.000000000 +0100
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/spufs.h	2007-01-03 21:13:48.000000000 +0100
@@ -73,6 +73,9 @@
 
 	struct list_head gang_list;
 	struct spu_gang *gang;
+
+	/* scheduler fields */
+	int prio;
 };
 
 struct spu_gang {
Index: linux-2.6/include/asm-powerpc/spu.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/spu.h	2007-01-03 21:13:05.000000000 +0100
+++ linux-2.6/include/asm-powerpc/spu.h	2007-01-03 21:13:48.000000000 +0100
@@ -128,7 +128,6 @@
 	struct spu_runqueue *rq;
 	unsigned long long timestamp;
 	pid_t pid;
-	int prio;
 	int class_0_pending;
 	spinlock_t register_lock;
 
Index: linux-2.6/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6.orig/arch/powerpc/xmon/xmon.c	2007-01-03 21:13:05.000000000 +0100
+++ linux-2.6/arch/powerpc/xmon/xmon.c	2007-01-03 21:13:48.000000000 +0100
@@ -2811,7 +2811,6 @@
 	DUMP_FIELD(spu, "0x%lx", irqs[2]);
 	DUMP_FIELD(spu, "0x%x", slb_replace);
 	DUMP_FIELD(spu, "%d", pid);
-	DUMP_FIELD(spu, "%d", prio);
 	DUMP_FIELD(spu, "0x%p", mm);
 	DUMP_FIELD(spu, "0x%p", ctx);
 	DUMP_FIELD(spu, "0x%p", rq);



More information about the cbe-oss-dev mailing list