Forráskód Böngészése

drop sched_ctx locking requirements on task counters out of performance concerns
TODO: add proper but lightweight-enough locking scheme for counters

Olivier Aumage 8 éve
szülő
commit
24a7838785
2 módosított fájl, 2 hozzáadás és 6 törlés
  1. 2 4
      src/core/sched_ctx.c
  2. 0 2
      src/core/sched_policy.c

+ 2 - 4
src/core/sched_ctx.c

@@ -2242,14 +2242,14 @@ void starpu_sched_ctx_list_task_counters_reset(unsigned sched_ctx_id, int worker
 		_starpu_sched_ctx_list_pop_all_event(worker->sched_ctx_list, sched_ctx_id);
 }
 
-/* sched_ctx must be write locked when calling this function */
 void starpu_sched_ctx_list_task_counters_increment_all(struct starpu_task *task, unsigned sched_ctx_id)
 {
+	/* TODO: add proper, but light-enough locking to sched_ctx counters */
+
 	/* Note that with 1 ctx we will default to the global context,
 	   hence our counters are useless */
 	if (_starpu_get_nsched_ctxs() > 1)
 	{
-		STARPU_SCHED_CTX_CHECK_LOCK(sched_ctx_id);
 		struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 		struct starpu_sched_ctx_iterator it;
 
@@ -2274,7 +2274,6 @@ void starpu_sched_ctx_list_task_counters_decrement_all(struct starpu_task *task,
 			STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&curr_worker_str->sched_mutex);
 		}
 
-		_starpu_sched_ctx_lock_write(sched_ctx_id);
 		struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 		struct starpu_sched_ctx_iterator it;
 		workers->init_iterator_for_parallel_tasks(workers, &it, task);
@@ -2290,7 +2289,6 @@ void starpu_sched_ctx_list_task_counters_decrement_all(struct starpu_task *task,
 				STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker_str->sched_mutex);
 			}
 		}
-		_starpu_sched_ctx_unlock_write(sched_ctx_id);
 
 		if(curr_workerid != -1)
 			STARPU_PTHREAD_MUTEX_LOCK_SCHED(&curr_worker_str->sched_mutex);

+ 0 - 2
src/core/sched_policy.c

@@ -589,7 +589,6 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 		{
 			STARPU_ASSERT(sched_ctx->sched_policy->push_task);
 			/* check out if there are any workers in the context */
-			_starpu_sched_ctx_lock_write(sched_ctx->id);
 			nworkers = starpu_sched_ctx_get_nworkers(sched_ctx->id);
 			if (nworkers == 0)
 				ret = -1;
@@ -600,7 +599,6 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 				ret = sched_ctx->sched_policy->push_task(task);
 				_STARPU_SCHED_END;
 			}
-			_starpu_sched_ctx_unlock_write(sched_ctx->id);
 		}
 
 		if(ret == -1)