Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tklauser
Copy link
Owner

The sched_getaffinity syscall returns the mask of online CPUs, so prefer
that over reading sysfs files on Linux. Only if the syscall returns an
errors, fall back to the existing method.

Running strace getconf _NPROCESSORS_ONLN this also seems to be the
method glibc's getconf uses.

The sched_getaffinity syscall returns the mask of online CPUs, so prefer
that over reading sysfs files on Linux. Only if the syscall returns an
errors, fall back to the existing method.

Running `strace getconf _NPROCESSORS_ONLN` this also seems to be the
method glibc's `getconf` uses.
@tklauser tklauser merged commit ce6ed4c into master Aug 17, 2021
@tklauser tklauser deleted the online-cpus-sched-getaffinity branch August 17, 2021 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants