Bug 2325167

Summary: coreutils: nproc ignores affinity mask on machines with more than 1024 CPUs
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: coreutilsAssignee: Florian Weimer <fweimer>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 41CC: admiller, jamartis, kdudka, kzak, lzaoral, nixuser, ovasik, p, svashisht, vmihalko
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: coreutils-9.4-9.fc40 coreutils-9.5-11.fc41 coreutils-9.5-11.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-14 07:59:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
coreutils-nproc-affinity.patch
none
coreutils-nproc-affinity.patch none

Description Florian Weimer 2024-11-11 11:29:27 UTC
The nproc tool calls sched_getaffinity with a fixed number of 1024 CPUs. This always fails on machines that have more CPUs. As a result, the sysconf fallback is used, resulting in unexpected results. It is necessary to use the glibc 2.6 APIs and retry with increasing CPU set sizes.


Reproducible: Always

Comment 1 Florian Weimer 2024-11-11 11:30:18 UTC
Created attachment 2057010 [details]
coreutils-nproc-affinity.patch

Comment 2 Florian Weimer 2024-11-11 11:33:58 UTC
Real upstream for this is gnulib, lib/nproc.c is copied from there.

Comment 3 Florian Weimer 2024-11-11 12:12:23 UTC
Patch submitted upstream:

[PATCH] nproc: Use affinity mask even on systems with more than 1024 CPUs
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00082.html>

Comment 4 Florian Weimer 2024-11-11 13:32:44 UTC
Created attachment 2057030 [details]
coreutils-nproc-affinity.patch

Comment 5 Pádraig Brady 2024-11-11 13:34:42 UTC
I'll sync this to the coreutils upstream repo and add a NEWS entry.
thanks

Comment 7 Fedora Update System 2024-11-13 09:07:36 UTC
FEDORA-2024-4b75866373 (coreutils-9.5-11.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-4b75866373

Comment 8 Fedora Update System 2024-11-13 10:20:29 UTC
FEDORA-2024-2fed0a200b (coreutils-9.5-11.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-2fed0a200b

Comment 9 Fedora Update System 2024-11-13 10:36:49 UTC
FEDORA-2024-b2eca2c8af (coreutils-9.4-9.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-b2eca2c8af

Comment 10 Fedora Update System 2024-11-14 02:13:34 UTC
FEDORA-2024-4b75866373 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-4b75866373`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-4b75866373

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2024-11-14 03:32:08 UTC
FEDORA-2024-b2eca2c8af has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-b2eca2c8af`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-b2eca2c8af

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2024-11-14 07:59:25 UTC
FEDORA-2024-2fed0a200b (coreutils-9.5-11.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2024-11-15 01:20:45 UTC
FEDORA-2024-4b75866373 (coreutils-9.5-11.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2024-11-20 16:21:57 UTC
FEDORA-2024-b2eca2c8af (coreutils-9.4-9.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.