]> err.no Git - linux-2.6/commitdiff
[CELL] spufs: integration of SPE affinity with the scheduller
authorArnd Bergmann <arnd@arndb.de>
Fri, 20 Jul 2007 19:39:49 +0000 (21:39 +0200)
committerArnd Bergmann <arnd@klappe.arndb.de>
Fri, 20 Jul 2007 19:42:18 +0000 (21:42 +0200)
This patch makes the scheduller honor affinity information for each
context being scheduled. If the context has no affinity information,
behaviour is unchanged. If there are affinity information, context is
schedulled to be run on the exact spu recommended by the affinity
placement algorithm.

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
arch/powerpc/platforms/cell/spu_base.c
arch/powerpc/platforms/cell/spufs/sched.c

index 75b5af0a7e21f20f3682cb85041573d9aea69ac3..5f399313b4727134d317fc383d070f62aa96506c 100644 (file)
@@ -425,6 +425,25 @@ static void spu_init_channels(struct spu *spu)
        }
 }
 
+struct spu *spu_alloc_spu(struct spu *req_spu)
+{
+       struct spu *spu, *ret = NULL;
+
+       mutex_lock(&spu_mutex);
+       list_for_each_entry(spu, &cbe_spu_info[req_spu->node].free_spus, list) {
+               if (spu == req_spu) {
+                       list_del_init(&spu->list);
+                       pr_debug("Got SPU %d %d\n", spu->number, spu->node);
+                       spu_init_channels(spu);
+                       ret = spu;
+                       break;
+               }
+       }
+       mutex_unlock(&spu_mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(spu_alloc_spu);
+
 struct spu *spu_alloc_node(int node)
 {
        struct spu *spu = NULL;
index a9569de4c141fb11fc8b52a11d3f2502de90a667..49b8f6867a96924f763b1d922fc0c2265494b1b9 100644 (file)
@@ -507,6 +507,10 @@ static struct spu *spu_get_idle(struct spu_context *ctx)
        int node = cpu_to_node(raw_smp_processor_id());
        int n;
 
+       spu = affinity_check(ctx);
+       if (spu)
+               return spu_alloc_spu(spu);
+
        for (n = 0; n < MAX_NUMNODES; n++, node++) {
                node = (node < MAX_NUMNODES) ? node : 0;
                if (!node_allowed(ctx, node))