mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8292541: [Metrics] Reported memory limit may exceed physical machine memory
Reviewed-by: stuefe, sgehwolf
This commit is contained in:
parent
c74b6d4552
commit
9a0d1e7ce8
3 changed files with 52 additions and 16 deletions
|
@ -121,7 +121,13 @@ public class CgroupMetrics implements Metrics {
|
|||
|
||||
@Override
|
||||
public long getMemoryLimit() {
|
||||
return subsystem.getMemoryLimit();
|
||||
long subsMem = subsystem.getMemoryLimit();
|
||||
// Catch the cgroup memory limit exceeding host physical memory.
|
||||
// Treat this as unlimited.
|
||||
if (subsMem >= getTotalMemorySize0()) {
|
||||
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
|
||||
}
|
||||
return subsMem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,5 +184,6 @@ public class CgroupMetrics implements Metrics {
|
|||
}
|
||||
|
||||
private static native boolean isUseContainerSupport();
|
||||
private static native long getTotalMemorySize0();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue