瀏覽代碼

rename wake_worker* routines to distinguish between two flavors

Olivier Aumage 8 年之前
父節點
當前提交
cdb9792226

+ 2 - 2
include/starpu_scheduler.h

@@ -60,8 +60,8 @@ void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sc
 unsigned long starpu_task_get_job_id(struct starpu_task *task);
 
 /* This function must be called to wake up a worker that is sleeping on the cond. 
- * It returns 0 whenever the worker is not in a sleeping state */
-int starpu_wake_worker(int workerid);
+ * It returns 0 whenever the worker is not in a sleeping state or has the state_keep_awake flag on */
+int starpu_wake_worker_no_relax(int workerid);
 /* This is a version of starpu_wake_worker which assumes that the sched mutex is locked */
 int starpu_wake_worker_locked(int workerid);
 

+ 3 - 3
src/core/workers.c

@@ -2126,7 +2126,7 @@ static int starpu_wakeup_worker_locked(int workerid, starpu_pthread_cond_t *sche
 	return 0;
 }
 
-static int starpu_wakeup_worker(int workerid, starpu_pthread_cond_t *sched_cond, starpu_pthread_mutex_t *sched_mutex)
+static int starpu_wakeup_worker_no_relax(int workerid, starpu_pthread_cond_t *sched_cond, starpu_pthread_mutex_t *sched_mutex)
 {
 	int success;
 	STARPU_PTHREAD_MUTEX_LOCK_SCHED(sched_mutex);
@@ -2143,12 +2143,12 @@ int starpu_wake_worker_locked(int workerid)
 	return starpu_wakeup_worker_locked(workerid, sched_cond, sched_mutex);
 }
 
-int starpu_wake_worker(int workerid)
+int starpu_wake_worker_no_relax(int workerid)
 {
 	starpu_pthread_mutex_t *sched_mutex;
 	starpu_pthread_cond_t *sched_cond;
 	starpu_worker_get_sched_condition(workerid, &sched_mutex, &sched_cond);
-	return starpu_wakeup_worker(workerid, sched_cond, sched_mutex);
+	return starpu_wakeup_worker_no_relax(workerid, sched_cond, sched_mutex);
 }
 
 int starpu_worker_get_nids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)

+ 8 - 0
src/core/workers.h

@@ -940,4 +940,12 @@ static inline void _starpu_worker_unlock_self(void)
 	STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 }
 
+static inline int _starpu_wake_worker_relax(int workerid)
+{
+	_starpu_worker_lock(workerid);
+	int ret = starpu_wake_worker_locked(workerid);
+	_starpu_worker_unlock(workerid);
+	return ret;
+}
+
 #endif // __WORKERS_H__

+ 1 - 1
src/sched_policies/eager_central_policy.c

@@ -125,7 +125,7 @@ static int push_task_eager_policy(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (starpu_wake_worker(worker))
+			if (_starpu_wake_worker_relax(worker))
 				break; // wake up a single worker
 	}
 #endif

+ 2 - 4
src/sched_policies/eager_central_priority_policy.c

@@ -179,7 +179,7 @@ static int _starpu_priority_push_task(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (starpu_wake_worker(worker))
+			if (_starpu_wake_worker_relax(worker))
 				break; // wake up a single worker
 	}
 #endif
@@ -263,9 +263,7 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 #ifdef STARPU_NON_BLOCKING_DRIVERS
 				starpu_bitmap_unset(data->waiters, worker);
 #else
-				_starpu_worker_lock_for_observation(worker);
-				starpu_wake_worker_locked(worker);
-				_starpu_worker_unlock(worker);
+				_starpu_wake_worker_relax(worker);
 #endif
 			}
 		}

+ 1 - 4
src/sched_policies/graph_test_policy.c

@@ -281,10 +281,7 @@ static int push_task_graph_test_policy(struct starpu_task *task)
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
 		{
-			_starpu_worker_lock(worker);
-			int ret = starpu_wake_worker(worker);
-			_starpu_worker_unlock(worker);
-			if (ret)
+			if (_starpu_wake_worker_relax(worker))
 				break; // wake up a single worker
 		}
 	}

+ 1 - 1
src/sched_policies/heteroprio.c

@@ -438,7 +438,7 @@ static int push_task_heteroprio_policy(struct starpu_task *task)
 	{
 		unsigned worker = workers->get_next(workers, &it);
 		if (dowake[worker])
-			if (starpu_wake_worker(worker))
+			if (_starpu_wake_worker_relax(worker))
 				break; // wake up a single worker
 	}
 #endif

+ 1 - 1
src/sched_policies/parallel_eager.c

@@ -170,7 +170,7 @@ static int push_task_peager_policy(struct starpu_task *task)
 		    starpu_worker_get_type(worker) != STARPU_MIC_WORKER &&
 		    starpu_worker_get_type(worker) != STARPU_CPU_WORKER)
 			|| (master == worker))
-			starpu_wake_worker(worker);
+			_starpu_wake_worker_relax(worker);
 	}
 #endif