Prechádzať zdrojové kódy

hypervisor: fix a deadlock when using lazy resize and perf counters

This fixes a deadlock when SC_HYPERVISOR_LAZY_RESIZE is set to 1 (default
behaviour) because the mutex is already acquired in notify_post_exec_hook()
and not released before the call to _ack_resize_completed() which will again
try to lock the same mutex. This fixes the app_driven.test.c example.
Samuel Pitoiset 9 rokov pred
rodič
commit
6f5db044a9
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      sc_hypervisor/src/sc_hypervisor.c

+ 2 - 1
sc_hypervisor/src/sc_hypervisor.c

@@ -1376,9 +1376,10 @@ static void notify_post_exec_task(struct starpu_task *task, size_t data_size, ui
 
 	starpu_pthread_mutex_lock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
 	hypervisor.sched_ctx_w[sched_ctx].remaining_flops -= flops;
+	starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
+
 	if(_sc_hypervisor_use_lazy_resize())
 		_ack_resize_completed(sched_ctx, worker);
-	starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
 
 	if(starpu_sched_ctx_get_hierarchy_level(sched_ctx) > 0)
 	{