RFR: 8265836: OperatingSystemImpl.getCpuLoad() returns incorrect CPU load

Hao Tang github.com+7947546+tanghaoth90 at openjdk.java.net
Thu May 6 02:36:54 UTC 2021


On Wed, 5 May 2021 21:16:07 GMT, Argha C <github.com+971473+argha-c at openjdk.org> wrote:

> Thanks for linking that. It sounds reasonable to me to prefer `quota` in that case.

Yes, flag `PreferContainerQuotaForCPUCount` is [true by default](https://github.com/openjdk/jdk/blob/739769c8/src/hotspot/os/linux/globals_linux.hpp#L62). Therefore, [my current implementation](https://github.com/openjdk/jdk/pull/3656/commits/b052b624c84) might be a minimal implementation.

We can also cover the case where `PreferContainerQuotaForCPUCount` is false. There are two different ways.
1. To access the value of `PreferContainerQuotaForCPUCount`, so that we can decide if we should use `quota` or (`quota` &  `share`);
2. Reuse `CgroupSubsystem::active_processor_count`. However, the function returns an integer. It is more reasonable to use a floating number.

Looking forward to your suggestion.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3656


More information about the serviceability-dev mailing list