aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/context.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-10-04 11:26:15 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-04 19:21:01 -0400
commit6263203ed6e9ff107129a1ebe613290b342a4465 (patch)
treedc7d68b783fed2b5ffcb8905c62086ebe078368b /arch/powerpc/platforms/cell/spufs/context.c
parent9add11daeee2f6d69f6b86237f197824332a4a3b (diff)
[POWERPC] spufs: Add infrastructure needed for gang scheduling
Add the concept of a gang to spufs as a new type of object. So far, this has no impact whatsover on scheduling, but makes it possible to add that later. A new type of object in spufs is now a spu_gang. It is created with the spu_create system call with the flags argument set to SPU_CREATE_GANG (0x2). Inside of a spu_gang, it is then possible to create spu_context objects, which until now was only possible at the root of spufs. There is a new member in struct spu_context pointing to the spu_gang it belongs to, if any. The spu_gang maintains a list of spu_context structures that are its children. This information can then be used in the scheduler in the future. There is still a bug that needs to be resolved in this basic infrastructure regarding the order in which objects are removed. When the spu_gang file descriptor is closed before the spu_context descriptors, we leak the dentry and inode for the gang. Any ideas how to cleanly solve this are appreciated. Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/context.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 36439c5e9f2d..034cf6af53a2 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -27,7 +27,7 @@
27#include <asm/spu_csa.h> 27#include <asm/spu_csa.h>
28#include "spufs.h" 28#include "spufs.h"
29 29
30struct spu_context *alloc_spu_context(void) 30struct spu_context *alloc_spu_context(struct spu_gang *gang)
31{ 31{
32 struct spu_context *ctx; 32 struct spu_context *ctx;
33 ctx = kzalloc(sizeof *ctx, GFP_KERNEL); 33 ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
@@ -51,6 +51,8 @@ struct spu_context *alloc_spu_context(void)
51 ctx->state = SPU_STATE_SAVED; 51 ctx->state = SPU_STATE_SAVED;
52 ctx->ops = &spu_backing_ops; 52 ctx->ops = &spu_backing_ops;
53 ctx->owner = get_task_mm(current); 53 ctx->owner = get_task_mm(current);
54 if (gang)
55 spu_gang_add_ctx(gang, ctx);
54 goto out; 56 goto out;
55out_free: 57out_free:
56 kfree(ctx); 58 kfree(ctx);
@@ -67,6 +69,8 @@ void destroy_spu_context(struct kref *kref)
67 spu_deactivate(ctx); 69 spu_deactivate(ctx);
68 up_write(&ctx->state_sema); 70 up_write(&ctx->state_sema);
69 spu_fini_csa(&ctx->csa); 71 spu_fini_csa(&ctx->csa);
72 if (ctx->gang)
73 spu_gang_remove_ctx(ctx->gang, ctx);
70 kfree(ctx); 74 kfree(ctx);
71} 75}
72 76