RFR: 8281181: Do not use CPU Shares to compute active processor count
David Holmes
dholmes at openjdk.java.net
Thu Mar 3 02:35:59 UTC 2022
On Wed, 2 Mar 2022 20:01:46 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> This is a simple change (Linux-only) that removes the consideration of Cgroups CPU Shares from the active process count calculation. Of note, this fixes CPU underutilization when Java is executed by Kubernetes without CPU resources limits.
>
> Please see the CSR [JDK-8281571](https://bugs.openjdk.java.net/browse/JDK-8281571) for a detailed discussion of the reasons to make this change.
>
> To err on the side of caution, we added a temporary (and deprecated) VM flag `-XX:+UseContainerCpuShares` to enable the old behavior. We believe the old behavior is wrong and unnecessary. The plan is to remove the old behavior in JDK 20.
>
> The associated flag, `PreferContainerQuotaForCPUCount` is also deprecated. Both flags will be obsoleted in JDK 20.
>
> Testing with tiers 1-4, as well as container tests in tier5.
Hi Ioi,
Generally looks good. A couple of nits below.
The deprecated flags should be added to the VMDeprecatedOptions test.
Thanks,
David
src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 500:
> 498:
> 499: // It's not a good idea to use cpu_shares() to limit the number
> 500: // of CPUs used by the JVM. See JDK-8281571.
I suggest using JDK-8281181 rather than the CSR issue.
test/hotspot/jtreg/containers/docker/TestCPUAwareness.java line 104:
> 102:
> 103: // OLD = use the deprecated -XX:+UseContainerCpuShares flag, which
> 104: // will be removed in the next JDK release. See JDK-8281571.
I suggest using JDK-8281181 rather than the CSR issue.
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7666
More information about the hotspot-dev
mailing list