diff options
author | Christoph Hellwig <hch@lst.de> | 2007-06-28 20:58:02 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-03 01:24:46 -0400 |
commit | 65de66f0b8bcb7431d9df82cf32b002062b3a611 (patch) | |
tree | a81eef8195d7f2f1c8c0ad110577b1ca92999c7e /arch/powerpc/platforms/cell/spufs/context.c | |
parent | 476273adc7277333aed9963bc4dc9b39066d3038 (diff) |
[POWERPC] spufs: Implement /proc/spu_loadavg
Provide load average information for spu context. The format
is identical to /proc/loadavg, which is also where a lot of code
and concepts is borrowed from.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
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.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c index 6ff2a75589f3..f623d963fdc7 100644 --- a/arch/powerpc/platforms/cell/spufs/context.c +++ b/arch/powerpc/platforms/cell/spufs/context.c | |||
@@ -23,10 +23,14 @@ | |||
23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <asm/atomic.h> | ||
26 | #include <asm/spu.h> | 27 | #include <asm/spu.h> |
27 | #include <asm/spu_csa.h> | 28 | #include <asm/spu_csa.h> |
28 | #include "spufs.h" | 29 | #include "spufs.h" |
29 | 30 | ||
31 | |||
32 | atomic_t nr_spu_contexts = ATOMIC_INIT(0); | ||
33 | |||
30 | struct spu_context *alloc_spu_context(struct spu_gang *gang) | 34 | struct spu_context *alloc_spu_context(struct spu_gang *gang) |
31 | { | 35 | { |
32 | struct spu_context *ctx; | 36 | struct spu_context *ctx; |
@@ -55,6 +59,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) | |||
55 | spu_gang_add_ctx(gang, ctx); | 59 | spu_gang_add_ctx(gang, ctx); |
56 | ctx->cpus_allowed = current->cpus_allowed; | 60 | ctx->cpus_allowed = current->cpus_allowed; |
57 | spu_set_timeslice(ctx); | 61 | spu_set_timeslice(ctx); |
62 | |||
63 | atomic_inc(&nr_spu_contexts); | ||
58 | goto out; | 64 | goto out; |
59 | out_free: | 65 | out_free: |
60 | kfree(ctx); | 66 | kfree(ctx); |
@@ -74,6 +80,7 @@ void destroy_spu_context(struct kref *kref) | |||
74 | if (ctx->gang) | 80 | if (ctx->gang) |
75 | spu_gang_remove_ctx(ctx->gang, ctx); | 81 | spu_gang_remove_ctx(ctx->gang, ctx); |
76 | BUG_ON(!list_empty(&ctx->rq)); | 82 | BUG_ON(!list_empty(&ctx->rq)); |
83 | atomic_dec(&nr_spu_contexts); | ||
77 | kfree(ctx); | 84 | kfree(ctx); |
78 | } | 85 | } |
79 | 86 | ||