aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-10-15 20:11:12 -0400
committerJeremy Kerr <jk@ozlabs.org>2008-10-20 20:13:43 -0400
commitf027faa231f38c02e949352735eac76f29090809 (patch)
tree1d26e6f406d473f7eee9cb224dcffca613f6d1b9 /arch
parent14f693eeb5b16bc47ffa38d8b8838a654aedd53f (diff)
powerpc/spufs: Don't spu_acquire_saved unnecessarily in regs read
With most file readers (eg cat, dd), reading a context's regs file will result in two reads: the first to read the data, and the second to return EOF. Because each read performs a spu_acquire_saved, we end up descheduling and re-scheduling the context twice. This change does a simple check to see if we'd return EOF before calling spu_acquire_saved(), saving the extra schedule operation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index f139cd8b594d..b6f7b917b56c 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -548,6 +548,11 @@ spufs_regs_read(struct file *file, char __user *buffer,
548 int ret; 548 int ret;
549 struct spu_context *ctx = file->private_data; 549 struct spu_context *ctx = file->private_data;
550 550
551 /* pre-check for file position: if we'd return EOF, there's no point
552 * causing a deschedule */
553 if (*pos >= sizeof(ctx->csa.lscsa->gprs))
554 return 0;
555
551 ret = spu_acquire_saved(ctx); 556 ret = spu_acquire_saved(ctx);
552 if (ret) 557 if (ret)
553 return ret; 558 return ret;