RFR: 8268098: jdk.CPULoad event reports incorrect CPU usage inside a container
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Wed Jun 2 09:32:33 UTC 2021
jdk.CPULoad event reports CPU usage.
If JVM runs in a container which is limited CPU resource (quota, shares, cpu), it is incorrect.
When I ran following program inside a container with `--cpuset-cpu=0,1`, I expected jdk.CPULoad event reports 50%, however it reported 25% because container host has 4 CPUs.
public class InfiniteLoop{
public static void main(String[] args){
while(true){
}
}
}
jdk.CPULoad event uses the result from `get_cpu_load()` in os_perf_linux.cpp, but it does not consider cgroups.
-------------
Commit messages:
- 8268098: jdk.CPULoad event reports incorrect CPU usage inside a container
Changes: https://git.openjdk.java.net/jdk/pull/4299/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4299&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268098
Stats: 24 lines in 1 file changed: 21 ins; 2 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/4299.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4299/head:pull/4299
PR: https://git.openjdk.java.net/jdk/pull/4299
More information about the hotspot-runtime-dev
mailing list