diff options
| -rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 67595bc380dc..6253df5a436e 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
| @@ -312,6 +312,15 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff, | |||
| 312 | */ | 312 | */ |
| 313 | node = cpu_to_node(raw_smp_processor_id()); | 313 | node = cpu_to_node(raw_smp_processor_id()); |
| 314 | for (n = 0; n < MAX_NUMNODES; n++, node++) { | 314 | for (n = 0; n < MAX_NUMNODES; n++, node++) { |
| 315 | /* | ||
| 316 | * "available_spus" counts how many spus are not potentially | ||
| 317 | * going to be used by other affinity gangs whose reference | ||
| 318 | * context is already in place. Although this code seeks to | ||
| 319 | * avoid having affinity gangs with a summed amount of | ||
| 320 | * contexts bigger than the amount of spus in the node, | ||
| 321 | * this may happen sporadically. In this case, available_spus | ||
| 322 | * becomes negative, which is harmless. | ||
| 323 | */ | ||
| 315 | int available_spus; | 324 | int available_spus; |
| 316 | 325 | ||
| 317 | node = (node < MAX_NUMNODES) ? node : 0; | 326 | node = (node < MAX_NUMNODES) ? node : 0; |
| @@ -321,12 +330,10 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff, | |||
| 321 | available_spus = 0; | 330 | available_spus = 0; |
| 322 | mutex_lock(&cbe_spu_info[node].list_mutex); | 331 | mutex_lock(&cbe_spu_info[node].list_mutex); |
| 323 | list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { | 332 | list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { |
| 324 | if (spu->ctx && spu->ctx->gang | 333 | if (spu->ctx && spu->ctx->gang && !spu->ctx->aff_offset |
| 325 | && spu->ctx->aff_offset == 0) | 334 | && spu->ctx->gang->aff_ref_spu) |
| 326 | available_spus -= | 335 | available_spus -= spu->ctx->gang->contexts; |
| 327 | (spu->ctx->gang->contexts - 1); | 336 | available_spus++; |
| 328 | else | ||
| 329 | available_spus++; | ||
| 330 | } | 337 | } |
| 331 | if (available_spus < ctx->gang->contexts) { | 338 | if (available_spus < ctx->gang->contexts) { |
| 332 | mutex_unlock(&cbe_spu_info[node].list_mutex); | 339 | mutex_unlock(&cbe_spu_info[node].list_mutex); |
