8257746: Regression introduced with JDK-8250984 - memory might be null in some machines

Reviewed-by: hseigel
This commit is contained in:
Poonam Bajaj 2021-01-28 15:07:03 +00:00
parent 13ca433ff6
commit abc4300de9

View File

@ -444,14 +444,14 @@ public class CgroupV1Subsystem implements CgroupSubsystem, CgroupV1Metrics {
}
public long getMemoryAndSwapFailCount() {
if (!memory.isSwapEnabled()) {
if (memory != null && !memory.isSwapEnabled()) {
return getMemoryFailCount();
}
return getLongValue(memory, "memory.memsw.failcnt");
}
public long getMemoryAndSwapLimit() {
if (!memory.isSwapEnabled()) {
if (memory != null && !memory.isSwapEnabled()) {
return getMemoryLimit();
}
long retval = getLongValue(memory, "memory.memsw.limit_in_bytes");
@ -469,14 +469,14 @@ public class CgroupV1Subsystem implements CgroupSubsystem, CgroupV1Metrics {
}
public long getMemoryAndSwapMaxUsage() {
if (!memory.isSwapEnabled()) {
if (memory != null && !memory.isSwapEnabled()) {
return getMemoryMaxUsage();
}
return getLongValue(memory, "memory.memsw.max_usage_in_bytes");
}
public long getMemoryAndSwapUsage() {
if (!memory.isSwapEnabled()) {
if (memory != null && !memory.isSwapEnabled()) {
return getMemoryUsage();
}
return getLongValue(memory, "memory.memsw.usage_in_bytes");