Explorar o código

Avoid busy loop locking in valgrind

Samuel Thibault %!s(int64=4) %!d(string=hai) anos
pai
achega
e7e266bfa0
Modificáronse 2 ficheiros con 6 adicións e 2 borrados
  1. 3 1
      src/core/jobs.c
  2. 3 1
      tests/main/job.c

+ 3 - 1
src/core/jobs.c

@@ -149,8 +149,10 @@ struct _starpu_job* _starpu_get_job_associated_to_task_slow(struct starpu_task *
 
 	/* Saw _STARPU_JOB_SETTING, somebody is doing it, wait for it.
 	 * This is rare enough that busy-reading is fine enough. */
-	while ((job = task->starpu_private) == _STARPU_JOB_SETTING)
+	while ((job = task->starpu_private) == _STARPU_JOB_SETTING) {
+		STARPU_UYIELD();
 		STARPU_SYNCHRONIZE();
+	}
 
 	STARPU_RMB();
 	return job;

+ 3 - 1
tests/main/job.c

@@ -48,8 +48,10 @@ void dummy_func(void *arg)
 		for (i = 0; i < N; i++)
 		{
 			struct starpu_task *task;
-			while (!(task = tasks[i]))
+			while (!(task = tasks[i])) {
+				STARPU_UYIELD();
 				STARPU_SYNCHRONIZE();
+			}
 			STARPU_RMB();
 			starpu_task_get_job_id(task);
 		}