Page MenuHomePhabricator

[openmp] [runtime] Use getloadavg() on NetBSD as well
ClosedPublic

Authored by mgorny on Dec 9 2018, 3:52 AM.

Details

Summary

Switch NetBSD from reading /proc (which is broken) to getloadavg()
(which is already used by Darwin). NetBSD discourages using procfs
in favor of system API calls.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Dec 9 2018, 3:52 AM
mgorny marked an inline comment as done.Dec 9 2018, 3:53 AM
mgorny added inline comments.
runtime/src/z_Linux_util.cpp
2088 ↗(On Diff #177408)

BTW this one doesn't seem to be used either. If you agree, I can send a separate change removing it as well.

krytarowski requested changes to this revision.Dec 9 2018, 8:04 AM

The official core statement in NetBSD is to deprecate /proc. Can we switch to share code with KMP_OS_DARWIN? Are there any issues with it?

If there is need to count running threads, we shall use sysctl(3) to get the list of threads.

This revision now requires changes to proceed.Dec 9 2018, 8:04 AM

If there are any issues with getloadavg(3), I will prepare a sysctl(3)-based function.

I would leave intact the Linux code as it's used for sanity check.

mgorny updated this revision to Diff 177714.Dec 11 2018, 7:54 AM
mgorny retitled this revision from [openmp] [runtime] Remove wrong assertion about /proc/1 being first file to [openmp] [runtime] Use getloadavg() on NetBSD as well.
mgorny edited the summary of this revision. (Show Details)

@krytarowski, updated as requested. FTR, this branch is using different rules for load-balancing apparently.

krytarowski accepted this revision.Dec 11 2018, 9:38 AM
This revision is now accepted and ready to land.Dec 11 2018, 9:38 AM
This revision was automatically updated to reflect the committed changes.