]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/ppc-spufs-09-Improve-search-of-node-for-contexts-w.patch
Imported linux-2.6.27.39 suse/xen patches.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / ppc-spufs-09-Improve-search-of-node-for-contexts-w.patch
CommitLineData
2cb7cef9
BS
1Subject: Improve search of node for contexts with SPU affinity
2From: Andre Detsch <adetsch@br.ibm.com>
3References: 447133 - LTC50070
4
5This patch improves redability of the code responsible for trying to find
6a node with enough SPUs not committed to other affinity gangs.
7
8An additional check is also added, to avoid taking into account gangs that
9have no SPU affinity.
10
11Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
12Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13Signed-off-by: Olaf Hering <olh@suse.de>
14---
15 arch/powerpc/platforms/cell/spufs/sched.c | 19 +++++++++++++------
16 1 file changed, 13 insertions(+), 6 deletions(-)
17
18--- a/arch/powerpc/platforms/cell/spufs/sched.c
19+++ b/arch/powerpc/platforms/cell/spufs/sched.c
20@@ -312,6 +312,15 @@ static struct spu *aff_ref_location(stru
21 */
22 node = cpu_to_node(raw_smp_processor_id());
23 for (n = 0; n < MAX_NUMNODES; n++, node++) {
24+ /*
25+ * "available_spus" counts how many spus are not potentially
26+ * going to be used by other affinity gangs whose reference
27+ * context is already in place. Although this code seeks to
28+ * avoid having affinity gangs with a summed amount of
29+ * contexts bigger than the amount of spus in the node,
30+ * this may happen sporadically. In this case, available_spus
31+ * becomes negative, which is harmless.
32+ */
33 int available_spus;
34
35 node = (node < MAX_NUMNODES) ? node : 0;
36@@ -321,12 +330,10 @@ static struct spu *aff_ref_location(stru
37 available_spus = 0;
38 mutex_lock(&cbe_spu_info[node].list_mutex);
39 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
40- if (spu->ctx && spu->ctx->gang
41- && spu->ctx->aff_offset == 0)
42- available_spus -=
43- (spu->ctx->gang->contexts - 1);
44- else
45- available_spus++;
46+ if (spu->ctx && spu->ctx->gang && !spu->ctx->aff_offset
47+ && spu->ctx->gang->aff_ref_spu)
48+ available_spus -= spu->ctx->gang->contexts;
49+ available_spus++;
50 }
51 if (available_spus < ctx->gang->contexts) {
52 mutex_unlock(&cbe_spu_info[node].list_mutex);