diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-10-15 16:25:25 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-10-15 16:25:25 +0200 |
commit | 4764049dd620affcd3e2658dc7f03a6616370a29 (patch) | |
tree | 825118894e654bfef2f48c44024bc73ddd875920 /libgomp/config/linux | |
parent | f3d64372d777d7d6068df8167b6751c289963e85 (diff) | |
download | gcc-4764049dd620affcd3e2658dc7f03a6616370a29.zip gcc-4764049dd620affcd3e2658dc7f03a6616370a29.tar.gz gcc-4764049dd620affcd3e2658dc7f03a6616370a29.tar.bz2 |
openmp: Fix up handling of OMP_PLACES=threads(1)
When writing the places-*.c tests, I've noticed that we mishandle threads
abstract name with specified num-places if num-places isn't a multiple of
number of hw threads in a core. It then happily ignores the maximum count
and overwrites for the remaining hw threads in a core further places that
haven't been allocated.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* config/linux/affinity.c (gomp_affinity_init_level_1): For level 1
after creating count places clean up and return immediately.
* testsuite/libgomp.c/places-6.c: New test.
* testsuite/libgomp.c/places-7.c: New test.
* testsuite/libgomp.c/places-8.c: New test.
* testsuite/libgomp.c/places-9.c: New test.
* testsuite/libgomp.c/places-10.c: New test.
Diffstat (limited to 'libgomp/config/linux')
-rw-r--r-- | libgomp/config/linux/affinity.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libgomp/config/linux/affinity.c b/libgomp/config/linux/affinity.c index 82981b6..69e72a8 100644 --- a/libgomp/config/linux/affinity.c +++ b/libgomp/config/linux/affinity.c @@ -338,8 +338,13 @@ gomp_affinity_init_level_1 (int level, int this_level, unsigned long count, if (gomp_affinity_add_cpus (pl, first, 1, 0, true)) { CPU_CLR_S (first, gomp_cpuset_size, copy); - if (level == 1) - gomp_places_list_len++; + if (level == 1 + && ++gomp_places_list_len >= count) + { + fclose (f); + free (line); + return; + } } } if (*p == ',') |