Browse Source

address an lsan found issue where context task counters gets updated, accessing the task structure, while the corresponding task may already have been executed and destroyed by a worker

Olivier Aumage 8 years ago
parent
commit
1c6076a20e
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/sched_policies/eager_central_policy.c

+ 9 - 9
src/sched_policies/eager_central_policy.c

@@ -82,6 +82,15 @@ static int push_task_eager_policy(struct starpu_task *task)
 	data->fifo->ntasks++;
 	data->fifo->nprocessed++;
 
+	if (_starpu_get_nsched_ctxs() > 1)
+	{
+		_starpu_worker_relax_on();
+		_starpu_sched_ctx_lock_write(sched_ctx_id);
+		_starpu_worker_relax_off();
+		starpu_sched_ctx_list_task_counters_increment_all_ctx_locked(task, sched_ctx_id);
+		_starpu_sched_ctx_unlock_write(sched_ctx_id);
+	}
+
 	starpu_push_task_end(task);
 
 	/*if there are no tasks block */
@@ -132,15 +141,6 @@ static int push_task_eager_policy(struct starpu_task *task)
 	}
 #endif
 
-	if (_starpu_get_nsched_ctxs() > 1)
-	{
-		_starpu_worker_relax_on();
-		_starpu_sched_ctx_lock_write(sched_ctx_id);
-		_starpu_worker_relax_off();
-		starpu_sched_ctx_list_task_counters_increment_all_ctx_locked(task, sched_ctx_id);
-		_starpu_sched_ctx_unlock_write(sched_ctx_id);
-	}
-
 	return 0;
 }