]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.arch/ppc-spufs-07-Don-t-spu_acquire_saved-unnecessarily.patch
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.arch / ppc-spufs-07-Don-t-spu_acquire_saved-unnecessarily.patch
CommitLineData
00e5a55c
BS
1Subject: Don't spu_acquire_saved unnecessarily in regs read
2From: Jeremy Kerr <jk@ozlabs.org>
3References: 447133 - LTC50070
4
5With most file readers (eg cat, dd), reading a context's regs file will
6result in two reads: the first to read the data, and the second to
7return EOF. Because each read performs a spu_acquire_saved, we end up
8descheduling and re-scheduling the context twice.
9
10This change does a simple check to see if we'd return EOF before
11calling spu_acquire_saved(), saving the extra schedule operation.
12
13Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
14Signed-off-by: Olaf Hering <olh@suse.de>
15---
16 arch/powerpc/platforms/cell/spufs/file.c | 5 +++++
17 1 file changed, 5 insertions(+)
18
19--- a/arch/powerpc/platforms/cell/spufs/file.c
20+++ b/arch/powerpc/platforms/cell/spufs/file.c
21@@ -551,6 +551,11 @@ spufs_regs_read(struct file *file, char
22 int ret;
23 struct spu_context *ctx = file->private_data;
24
25+ /* pre-check for file position: if we'd return EOF, there's no point
26+ * causing a deschedule */
27+ if (*pos >= sizeof(ctx->csa.lscsa->gprs))
28+ return 0;
29+
30 ret = spu_acquire_saved(ctx);
31 if (ret)
32 return ret;