|
@@ -461,8 +461,8 @@ int _starpu_handle_node_data_requests(unsigned src_node, unsigned may_alloc, uns
|
|
|
#ifdef STARPU_NON_BLOCKING_DRIVERS
|
|
|
/* take all the entries from the request list */
|
|
|
if (STARPU_PTHREAD_MUTEX_TRYLOCK(&data_requests_list_mutex[src_node]))
|
|
|
- /* List is busy, do not bother with it */
|
|
|
{
|
|
|
+ /* List is busy, do not bother with it */
|
|
|
_starpu_data_request_list_delete(empty_list);
|
|
|
return -EBUSY;
|
|
|
}
|
|
@@ -476,7 +476,6 @@ int _starpu_handle_node_data_requests(unsigned src_node, unsigned may_alloc, uns
|
|
|
{
|
|
|
/* there is no request */
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&data_requests_list_mutex[src_node]);
|
|
|
-
|
|
|
_starpu_data_request_list_delete(empty_list);
|
|
|
return 0;
|
|
|
}
|
|
@@ -541,21 +540,22 @@ int _starpu_handle_node_data_requests(unsigned src_node, unsigned may_alloc, uns
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc, unsigned *pushed)
|
|
|
+int _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc, unsigned *pushed)
|
|
|
{
|
|
|
struct _starpu_data_request *r;
|
|
|
struct _starpu_data_request_list *new_data_requests;
|
|
|
struct _starpu_data_request_list *new_prefetch_requests;
|
|
|
struct _starpu_data_request_list *empty_list;
|
|
|
+ int ret = 0;
|
|
|
|
|
|
*pushed = 0;
|
|
|
|
|
|
#ifdef STARPU_NON_BLOCKING_DRIVERS
|
|
|
/* 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 */
|
|
|
+ * Thus, do not expose this optimization to helgrind */
|
|
|
if (!RUNNING_ON_VALGRIND && _starpu_data_request_list_empty(prefetch_requests[src_node]))
|
|
|
- return;
|
|
|
+ return 0;
|
|
|
#endif
|
|
|
|
|
|
empty_list = _starpu_data_request_list_new();
|
|
@@ -566,7 +566,7 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
{
|
|
|
/* List is busy, do not bother with it */
|
|
|
_starpu_data_request_list_delete(empty_list);
|
|
|
- return;
|
|
|
+ return -EBUSY;
|
|
|
}
|
|
|
#else
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(&data_requests_list_mutex[src_node]);
|
|
@@ -579,13 +579,14 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
/* there is no request */
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&data_requests_list_mutex[src_node]);
|
|
|
_starpu_data_request_list_delete(empty_list);
|
|
|
- return;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/* There is an entry: we create a new empty list to replace the list of
|
|
|
* requests, and we handle the request(s) one by one in the former
|
|
|
* list, without concurrency issues.*/
|
|
|
prefetch_requests[src_node] = empty_list;
|
|
|
+ STARPU_HG_DISABLE_CHECKING(prefetch_requests[src_node]->_head);
|
|
|
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&data_requests_list_mutex[src_node]);
|
|
|
|
|
@@ -601,6 +602,7 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
{
|
|
|
/* Too many requests at the same time, skip pushing
|
|
|
* more for now */
|
|
|
+ ret = -EBUSY;
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -609,6 +611,8 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
res = starpu_handle_data_request(r, may_alloc, 1);
|
|
|
if (res != 0 && res != -EAGAIN)
|
|
|
{
|
|
|
+ /* handle is busy, or not enough memory, postpone for now */
|
|
|
+ ret = res;
|
|
|
if (r->prefetch)
|
|
|
_starpu_data_request_list_push_back(new_prefetch_requests, r);
|
|
|
else
|
|
@@ -622,7 +626,7 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
(*pushed)++;
|
|
|
}
|
|
|
|
|
|
- while(!_starpu_data_request_list_empty(local_list))
|
|
|
+ while (!_starpu_data_request_list_empty(local_list))
|
|
|
{
|
|
|
r = _starpu_data_request_list_pop_front(local_list);
|
|
|
if (r->prefetch)
|
|
@@ -649,6 +653,8 @@ void _starpu_handle_node_prefetch_requests(unsigned src_node, unsigned may_alloc
|
|
|
_starpu_data_request_list_delete(new_data_requests);
|
|
|
_starpu_data_request_list_delete(new_prefetch_requests);
|
|
|
_starpu_data_request_list_delete(local_list);
|
|
|
+
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
static int _handle_pending_node_data_requests(unsigned src_node, unsigned force)
|