public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4478] openmp: Fix handling of numa_domains(1)
@ 2021-10-18 13:00 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-10-18 13:00 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3adcf7e104284b4867996b08f37ece50056ee8f6
commit r12-4478-g3adcf7e104284b4867996b08f37ece50056ee8f6
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Oct 18 14:54:16 2021 +0200
openmp: Fix handling of numa_domains(1)
If numa-domains is used with num-places count, sometimes the function
could create more places than requested and crash. This depended on the
content of /sys/devices/system/node/online file, e.g. if the file
contains
0-1,16-17
and all NUMA nodes contain at least one CPU in the cpuset of the program,
then numa_domains(2) or numa_domains(4) (or 5+) work fine while
numa_domains(1) or numa_domains(3) misbehave. I.e. the function was able
to stop after reaching limit on the , separators (or trivially at the end),
but not within in the ranges.
2021-10-18 Jakub Jelinek <jakub@redhat.com>
* config/linux/affinity.c (gomp_affinity_init_numa_domains): Add
&& gomp_places_list_len < count after nfirst <= nlast loop condition.
Diff:
---
libgomp/config/linux/affinity.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgomp/config/linux/affinity.c b/libgomp/config/linux/affinity.c
index e11906abec4..ce86c5898c1 100644
--- a/libgomp/config/linux/affinity.c
+++ b/libgomp/config/linux/affinity.c
@@ -401,7 +401,7 @@ gomp_affinity_init_numa_domains (unsigned long count, cpu_set_t *copy,
break;
q = end;
}
- for (; nfirst <= nlast; nfirst++)
+ for (; nfirst <= nlast && gomp_places_list_len < count; nfirst++)
{
sprintf (name + prefix_len, "node%lu/cpulist", nfirst);
f = fopen (name, "r");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-18 13:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 13:00 [gcc r12-4478] openmp: Fix handling of numa_domains(1) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).