-
Notifications
You must be signed in to change notification settings - Fork 383
fix[javalib]:Runtime#availableProcessors now respects cpuset on small Linux systems #3969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix[javalib]:Runtime#availableProcessors now respects cpuset on small Linux systems #3969
Conversation
All but one of the tests are Green. There is one macOS test which appears to be not making progress. I suspect that it will This PR is Linux only, so the macOS test "hang" is almost certainly an unrelated intermittent fault. I still have a bit of documenting to do in the issue itself. No rest for the wicked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you so much! @amsen20 please check if it does the right thing :)
* logical processes configured for the system (_SC_NPROCESSORS). | ||
* | ||
* Note that OpenMP environment variables are neither consulted nor used. | ||
* This consistent with Java. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This consistent with Java. | |
* This is consistent with Java. |
It works for me, thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked it locally and it worked
natsukagami, amsen20 Thank you both for your review & suggestion/correction. It is nice to know that the proposed solution actually works in the use case and not just on my machines. If either of you think there is a short term need for either > 1024 or for FreeBSD, please create an Issue. Somehow, I think we will all be back here again. |
There is one failing Windows Test. I appears to be an intermittent failure, Otherwise all Green & ready for review. |
Weakly fixes #3963
Runtime#availableProcessors
on small Linux systems now reports the number of logical processors allowby the process
cpuset
.This number may be smaller than that reported by
sysconf(_SC_NPROCESSORS_ONLN)
due to variousLinux mechanisms: cgroups, taskset, cpuset, etc.
'small' is defined as less than or equal to, currently, 1024. Above that limit
sysconf(_SC_NPROCESSORS_ONLN)
isreported, same as before this PR.
See Issue for discussion and manual testing instructions (next sprint). Most notably, OpenMP variables are not considered.