浏览代码

Document each racy spot normally reported by helgrind

Samuel Thibault 12 年之前
父节点
当前提交
aea35461df

+ 6 - 4
src/core/perfmodel/perfmodel_history.c

@@ -1112,8 +1112,9 @@ double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfm
 		HASH_FIND_UINT32_T(history, &key, entry);
 		STARPU_PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
 
-		/* We do not care about racing access to the mean, we only want a
-		 * good-enough estimation */
+		/* Here helgrind would shout that this is unprotected access.
+		 * We do not care about racing access to the mean, we only want
+		 * a good-enough estimation */
 
 		if (entry && entry->history_entry && entry->history_entry->nsample >= _STARPU_CALIBRATION_MINIMUM)
 			exp = entry->history_entry->mean;
@@ -1150,8 +1151,9 @@ double _starpu_history_based_job_expected_perf(struct starpu_perfmodel *model, e
 	entry = (elt == NULL) ? NULL : elt->history_entry;
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&model->model_rwlock);
 
-	/* We do not care about racing access to the mean, we only want a
-	 * good-enough estimation, thus simulate taking the rdlock */
+	/* Here helgrind would shout that this is unprotected access.
+	 * We do not care about racing access to the mean, we only want
+	 * a good-enough estimation */
 
 	if (entry && entry->nsample >= _STARPU_CALIBRATION_MINIMUM)
 		/* TODO: report differently if we've scheduled really enough

+ 3 - 0
src/datawizard/data_request.c

@@ -403,6 +403,9 @@ void _starpu_handle_node_data_requests(unsigned src_node, unsigned may_alloc)
 	struct _starpu_data_request *r;
 	struct _starpu_data_request_list *new_data_requests;
 
+	/* Here helgrind would should that this is an un protected access.
+	 * We however don't care about missing an entry, we will get called
+	 * again sooner or later. */
 	if (_starpu_data_request_list_empty(data_requests[src_node]))
 		return;
 

+ 3 - 0
src/sched_policies/eager_central_policy.c

@@ -123,6 +123,9 @@ static struct starpu_task *pop_task_eager_policy(unsigned sched_ctx_id)
 	struct starpu_task *task = NULL;
 
 	/* block until some event happens */
+	/* Here helgrind would shout that this is unprotected, this is just an
+	 * integer access, and we hold the sched mutex, so we can not miss any
+	 * wake up. */
 	if (_starpu_fifo_empty(data->fifo))
 		return NULL;
 

+ 3 - 0
src/sched_policies/eager_central_priority_policy.c

@@ -160,6 +160,9 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 	struct _starpu_priority_taskq *taskq = data->taskq;
 
 	/* block until some event happens */
+	/* Here helgrind would shout that this is unprotected, this is just an
+	 * integer access, and we hold the sched mutex, so we can not miss any
+	 * wake up. */
 	if (taskq->total_ntasks == 0)
 		return NULL;
 

+ 12 - 0
src/sched_policies/parallel_heft.c

@@ -196,6 +196,9 @@ static double compute_expected_end(int workerid, double length)
 		double res;
 		/* This is a basic worker */
 
+		/* Here helgrind would shout that this is unprotected, but we
+		 * are fine with getting outdated values, this is just an
+		 * estimation */
 		res = worker_exp_start[workerid] + worker_exp_len[workerid] + length;
 
 		return res;
@@ -209,6 +212,9 @@ static double compute_expected_end(int workerid, double length)
 
 		double exp_end = DBL_MIN;
 
+		/* Here helgrind would shout that this is unprotected, but we
+		 * are fine with getting outdated values, this is just an
+		 * estimation */
 		int i;
 		for (i = 0; i < worker_size; i++)
 		{
@@ -235,6 +241,9 @@ static double compute_ntasks_end(int workerid)
 		double res;
 		/* This is a basic worker */
 
+		/* Here helgrind would shout that this is unprotected, but we
+		 * are fine with getting outdated values, this is just an
+		 * estimation */
 		res = ntasks[workerid] / starpu_worker_get_relative_speedup(perf_arch);
 
 		return res;
@@ -248,6 +257,9 @@ static double compute_ntasks_end(int workerid)
 
 		int ntasks_end=0;
 
+		/* Here helgrind would shout that this is unprotected, but we
+		 * are fine with getting outdated values, this is just an
+		 * estimation */
 		int i;
 		for (i = 0; i < worker_size; i++)
 		{

+ 3 - 0
src/sched_policies/work_stealing_policy.c

@@ -73,6 +73,9 @@ static unsigned select_victim_round_robin(unsigned sched_ctx_id)
 		unsigned njobs;
 
 		starpu_worker_get_sched_condition(worker, &victim_sched_mutex, &victim_sched_cond);
+		/* Here helgrind would shout that this is unprotected, but we
+		 * are fine with getting outdated values, this is just an
+		 * estimation */
 		njobs = ws->queue_array[worker]->njobs;
 
 		if (njobs)