Selaa lähdekoodia

Do not expose a known-to-be-racy-but-we-re-fine optimization to helgrind

Samuel Thibault 11 vuotta sitten
vanhempi
commit
9218801246
1 muutettua tiedostoa jossa 12 lisäystä ja 6 poistoa
  1. 12 6
      src/datawizard/data_request.c

+ 12 - 6
src/datawizard/data_request.c

@@ -424,10 +424,10 @@ int _starpu_handle_node_data_requests(unsigned src_node, unsigned may_alloc, uns
 
 	*pushed = 0;
 
-	/* 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]))
+	/* This is racy, but not posing problems actually, since we know we
+	 * will come back here to probe again regularly anyway.
+	 * Thus, do not expose this optimization to helgrind */
+	if (!RUNNING_ON_VALGRIND && _starpu_data_request_list_empty(data_requests[src_node]))
 		return 0;
 
 	empty_list = _starpu_data_request_list_new();
@@ -513,7 +513,10 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
 
 	*pushed = 0;
 
-	if (_starpu_data_request_list_empty(prefetch_requests[src_node]))
+	/* This is racy, but not posing problems actually, since we know we
+	 * will come back here to probe again regularly anyway.
+	 * Thus, do not expose this optimization to valgrind */
+	if (!RUNNING_ON_VALGRIND && _starpu_data_request_list_empty(prefetch_requests[src_node]))
 		return;
 
 	empty_list = _starpu_data_request_list_new();
@@ -606,7 +609,10 @@ static int _handle_pending_node_data_requests(unsigned src_node, unsigned force)
 	struct _starpu_data_request_list *empty_list;
 	unsigned taken, kept;
 
-	if (_starpu_data_request_list_empty(data_requests_pending[src_node]))
+	/* 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 (!RUNNING_ON_VALGRIND && _starpu_data_request_list_empty(data_requests_pending[src_node]))
 		return 0;
 
 	empty_list = _starpu_data_request_list_new();