|
@@ -191,7 +191,6 @@ static int _starpu_priority_push_task(struct starpu_task *task)
|
|
|
|
|
|
static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
|
|
|
{
|
|
|
- _starpu_worker_relax_on();
|
|
|
struct starpu_task *chosen_task = NULL, *task, *nexttask;
|
|
|
unsigned workerid = starpu_worker_get_id_check();
|
|
|
int skipped = 0;
|
|
@@ -200,16 +199,11 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
|
|
|
|
|
|
struct _starpu_priority_taskq *taskq = data->taskq;
|
|
|
|
|
|
- /* block until some event happens */
|
|
|
- STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
|
|
|
- _starpu_worker_relax_off();
|
|
|
-
|
|
|
/* 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_RUNNING_ON_VALGRIND && taskq->total_ntasks == 0)
|
|
|
{
|
|
|
- STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -217,10 +211,14 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
|
|
|
if (!STARPU_RUNNING_ON_VALGRIND && starpu_bitmap_get(data->waiters, workerid))
|
|
|
/* Nobody woke us, avoid bothering the mutex */
|
|
|
{
|
|
|
- STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
|
|
|
return NULL;
|
|
|
}
|
|
|
#endif
|
|
|
+ /* block until some event happens */
|
|
|
+ _starpu_worker_relax_on();
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
|
|
|
+ _starpu_worker_relax_off();
|
|
|
+
|
|
|
unsigned priolevel = taskq->max_prio - taskq->min_prio;
|
|
|
do
|
|
|
{
|