Conversation
_SC_NPROCESSORS_CONF
The number of processors configured. See also get_nprocs_conf(3).
_SC_NPROCESSORS_ONLN
The number of processors currently online (available). See also get_nprocs_conf(3).
A Fix for issue #815
Collaborator
Author
|
This still needs to be tested, I am creating the PR to see what other checks could fail. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1434 +/- ##
==========================================
+ Coverage 45.25% 45.72% +0.47%
==========================================
Files 367 367
Lines 39131 39130 -1
Branches 6617 6617
==========================================
+ Hits 17707 17893 +186
+ Misses 20751 20564 -187
Partials 673 673
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hook25
approved these changes
Sep 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test program retroeves the number of cpus using "num_cpus = sysconf(_SC_NPROCESSORS_CONF);". After an
upstream change in the kernel between 22.04 and 24.04, this returns now the number of physical cpus available.
But these cpus do not need to be available to the system right now. Looping over num_cpus, the call to
sched_setaffinity results in an error EINVAL which is explained with:
EINVAL The affinity bit mask mask contains no processors that are currently physi‐
cally on the system and permitted to the thread according to any restrictions
that may be imposed by cpuset cgroups or the "cpuset" mechanism described in
cpuset(7).
The correct way to retrieve the available number of cpus would be "num_cpus = sysconf(_SC_NPROCESSORS_ONLN);", as described here:
man sysconf
_SC_NPROCESSORS_CONF
The number of processors configured. See also get_nprocs_conf(3).
Description
Resolved issues
Documentation
Tests