Page MenuHomePhabricator

[OpenMP] Fix tasking bug for decreasing hot team nthreads

Authored by jlpeyton on Aug 13 2018, 10:47 AM.



The __kmp_execute_tasks_template() function reads the task_team and
current_task from the thread structure. There appears to be a pathological
timing where the number of threads in the hot team decreases and so a
thread is put in the pool via __kmp_free_thread(). It could be the case where
first: a thread reads th_task_team into task_team local variables

and is then interrupted by the OS

second: the master free's the thread and sets the current task and task team to NULL
third: the thread reads current_task as NULL

When this happens, current_task is dereferenced and a segfault occurs.
This patch just checks for current_task to not be NULL as well.

Diff Detail


Event Timeline

jlpeyton created this revision.Aug 13 2018, 10:47 AM
hbae accepted this revision.Aug 23 2018, 8:10 AM


This revision is now accepted and ready to land.Aug 23 2018, 8:10 AM
This revision was automatically updated to reflect the committed changes.