public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] openmp: Fix handling of numa_domains(1) Date: Tue, 19 Oct 2021 13:39:06 +0000 (GMT) [thread overview] Message-ID: <20211019133906.3D40F385800D@sourceware.org> (raw) https://gcc.gnu.org/g:d5a841968fb12b71c20fedad55d99656711dcc3e commit d5a841968fb12b71c20fedad55d99656711dcc3e Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Oct 19 08:30:52 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. (cherry picked from commit 3adcf7e104284b4867996b08f37ece50056ee8f6) Diff: --- libgomp/ChangeLog.omp | 8 ++++++++ libgomp/config/linux/affinity.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 12291307b64..157d89b9196 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,11 @@ +2021-10-19 Tobias Burnus <tobias@codesourcery.com> + + Backported from master: + 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. + 2021-10-15 Tobias Burnus <tobias@codesourcery.com> Backported from master: 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");
reply other threads:[~2021-10-19 13:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211019133906.3D40F385800D@sourceware.org \ --to=burnus@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).