re PR libgomp/66761 (libgomp: ThreadSanitizer: data race in libgomp)

PR libgomp/66761
        PR libgomp/67303
        * iter.c (gomp_iter_dynamic_next): Employ an atomic load.
        (gomp_iter_guided_next): Idem.
        * iter_ull.c (gomp_iter_ull_dynamic_next): Idem.
        (gomp_iter_ull_guided_next): Idem.
        * config/linux/wait.h (do_spin): Idem.

From-SVN: r227119
This commit is contained in:
Joost VandeVondele 2015-08-24 11:01:25 +00:00
parent d485982286
commit bfe7ac89a0
4 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2015-08-24 Joost VandeVondele <vondele@gnu.gcc.org>
PR libgomp/66761
PR libgomp/67303
* iter.c (gomp_iter_dynamic_next): Employ an atomic load.
(gomp_iter_guided_next): Idem.
* iter_ull.c (gomp_iter_ull_dynamic_next): Idem.
(gomp_iter_ull_guided_next): Idem.
* config/linux/wait.h (do_spin): Idem.
2015-08-10 Thomas Schwinge <thomas@codesourcery.com>
* libgomp-plugin.h (enum offload_target_type): Remove

View File

@ -49,7 +49,9 @@ static inline int do_spin (int *addr, int val)
{
unsigned long long i, count = gomp_spin_count_var;
if (__builtin_expect (gomp_managed_threads > gomp_available_cpus, 0))
if (__builtin_expect (__atomic_load_n (&gomp_managed_threads,
MEMMODEL_RELAXED)
> gomp_available_cpus, 0))
count = gomp_throttled_spin_count_var;
for (i = 0; i < count; i++)
if (__builtin_expect (__atomic_load_n (addr, MEMMODEL_RELAXED) != val, 0))

View File

@ -218,7 +218,7 @@ gomp_iter_dynamic_next (long *pstart, long *pend)
}
}
start = ws->next;
start = __atomic_load_n (&ws->next, MEMMODEL_RELAXED);
while (1)
{
long left = end - start;
@ -301,7 +301,7 @@ gomp_iter_guided_next (long *pstart, long *pend)
long start, end, nend, incr;
unsigned long chunk_size;
start = ws->next;
start = __atomic_load_n (&ws->next, MEMMODEL_RELAXED);
end = ws->end;
incr = ws->incr;
chunk_size = ws->chunk_size;

View File

@ -219,7 +219,7 @@ gomp_iter_ull_dynamic_next (gomp_ull *pstart, gomp_ull *pend)
}
}
start = ws->next_ull;
start = __atomic_load_n (&ws->next_ull, MEMMODEL_RELAXED);
while (1)
{
gomp_ull left = end - start;
@ -305,7 +305,7 @@ gomp_iter_ull_guided_next (gomp_ull *pstart, gomp_ull *pend)
gomp_ull start, end, nend, incr;
gomp_ull chunk_size;
start = ws->next_ull;
start = __atomic_load_n (&ws->next_ull, MEMMODEL_RELAXED);
end = ws->end_ull;
incr = ws->incr_ull;
chunk_size = ws->chunk_size_ull;