-
Notifications
You must be signed in to change notification settings - Fork 13.3k
openbsd: available_parallelism: use the right API #119436
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
Conversation
use the standard sysconf(_SC_NPROCESSORS_ONLN) way to get the number of available processors (capable of running processes), and fallback to sysctl([CTL_HW, HW_NCPU]) (number of CPUs configured) only on error. it permits to differenciate CPUs online vs CPUs configured (and not necessary capable of running processes). while here, use the common code path for BSDs for doing that, and avoid code duplication. Problem initially reported to me by Jiri Navratil.
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
as side note, I am the designated developer for OpenBSD in rust. |
@rustbot label -O-unix O-openbsd |
@bors r+ rollup |
see rust-lang/rust#119436 it makes std::thread::available_parallelism to use sysconf(_SC_NPROCESSORS_ONLN) and only fallback to sysctl([CTL_HW, HW_NCPU]). Problem reported by Jiri Navratil
☀️ Test successful - checks-actions |
Finished benchmarking commit (a2541e8): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.011s -> 668.901s (-0.02%) |
use the standard
sysconf(_SC_NPROCESSORS_ONLN)
way to get the number of available processors (capable of running processes), and fallback tosysctl([CTL_HW, HW_NCPU])
(number of CPUs configured) only on error.it permits to differenciate CPUs online (capable of running processes) vs CPUs configured (not necessary capable of running processes).
while here, use the common code path for BSDs for doing that, and avoid code duplication.
Problem initially reported to me by Jiri Navratil.