Merge commit 'jk/jk-merge'
This commit is contained in:
@@ -312,10 +312,27 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff,
|
|||||||
*/
|
*/
|
||||||
node = cpu_to_node(raw_smp_processor_id());
|
node = cpu_to_node(raw_smp_processor_id());
|
||||||
for (n = 0; n < MAX_NUMNODES; n++, node++) {
|
for (n = 0; n < MAX_NUMNODES; n++, node++) {
|
||||||
|
int available_spus;
|
||||||
|
|
||||||
node = (node < MAX_NUMNODES) ? node : 0;
|
node = (node < MAX_NUMNODES) ? node : 0;
|
||||||
if (!node_allowed(ctx, node))
|
if (!node_allowed(ctx, node))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
available_spus = 0;
|
||||||
mutex_lock(&cbe_spu_info[node].list_mutex);
|
mutex_lock(&cbe_spu_info[node].list_mutex);
|
||||||
|
list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
|
||||||
|
if (spu->ctx && spu->ctx->gang
|
||||||
|
&& spu->ctx->aff_offset == 0)
|
||||||
|
available_spus -=
|
||||||
|
(spu->ctx->gang->contexts - 1);
|
||||||
|
else
|
||||||
|
available_spus++;
|
||||||
|
}
|
||||||
|
if (available_spus < ctx->gang->contexts) {
|
||||||
|
mutex_unlock(&cbe_spu_info[node].list_mutex);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
|
list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
|
||||||
if ((!mem_aff || spu->has_mem_affinity) &&
|
if ((!mem_aff || spu->has_mem_affinity) &&
|
||||||
sched_spu(spu)) {
|
sched_spu(spu)) {
|
||||||
@@ -389,6 +406,9 @@ static int has_affinity(struct spu_context *ctx)
|
|||||||
if (list_empty(&ctx->aff_list))
|
if (list_empty(&ctx->aff_list))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (atomic_read(&ctx->gang->aff_sched_count) == 0)
|
||||||
|
ctx->gang->aff_ref_spu = NULL;
|
||||||
|
|
||||||
if (!gang->aff_ref_spu) {
|
if (!gang->aff_ref_spu) {
|
||||||
if (!(gang->aff_flags & AFF_MERGED))
|
if (!(gang->aff_flags & AFF_MERGED))
|
||||||
aff_merge_remaining_ctxs(gang);
|
aff_merge_remaining_ctxs(gang);
|
||||||
@@ -416,14 +436,8 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
|
|||||||
if (spu->ctx->flags & SPU_CREATE_NOSCHED)
|
if (spu->ctx->flags & SPU_CREATE_NOSCHED)
|
||||||
atomic_dec(&cbe_spu_info[spu->node].reserved_spus);
|
atomic_dec(&cbe_spu_info[spu->node].reserved_spus);
|
||||||
|
|
||||||
if (ctx->gang){
|
if (ctx->gang)
|
||||||
mutex_lock(&ctx->gang->aff_mutex);
|
atomic_dec_if_positive(&ctx->gang->aff_sched_count);
|
||||||
if (has_affinity(ctx)) {
|
|
||||||
if (atomic_dec_and_test(&ctx->gang->aff_sched_count))
|
|
||||||
ctx->gang->aff_ref_spu = NULL;
|
|
||||||
}
|
|
||||||
mutex_unlock(&ctx->gang->aff_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
spu_switch_notify(spu, NULL);
|
spu_switch_notify(spu, NULL);
|
||||||
spu_unmap_mappings(ctx);
|
spu_unmap_mappings(ctx);
|
||||||
@@ -562,10 +576,7 @@ static struct spu *spu_get_idle(struct spu_context *ctx)
|
|||||||
goto found;
|
goto found;
|
||||||
mutex_unlock(&cbe_spu_info[node].list_mutex);
|
mutex_unlock(&cbe_spu_info[node].list_mutex);
|
||||||
|
|
||||||
mutex_lock(&ctx->gang->aff_mutex);
|
atomic_dec(&ctx->gang->aff_sched_count);
|
||||||
if (atomic_dec_and_test(&ctx->gang->aff_sched_count))
|
|
||||||
ctx->gang->aff_ref_spu = NULL;
|
|
||||||
mutex_unlock(&ctx->gang->aff_mutex);
|
|
||||||
goto not_found;
|
goto not_found;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ctx->gang->aff_mutex);
|
mutex_unlock(&ctx->gang->aff_mutex);
|
||||||
|
@@ -196,8 +196,7 @@ static int __init sputrace_init(void)
|
|||||||
struct proc_dir_entry *entry;
|
struct proc_dir_entry *entry;
|
||||||
int i, error = -ENOMEM;
|
int i, error = -ENOMEM;
|
||||||
|
|
||||||
sputrace_log = kcalloc(sizeof(struct sputrace),
|
sputrace_log = kcalloc(bufsize, sizeof(struct sputrace), GFP_KERNEL);
|
||||||
bufsize, GFP_KERNEL);
|
|
||||||
if (!sputrace_log)
|
if (!sputrace_log)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user