On Wed, 27 Jan 2021 21:10:16 GMT, Poonam Bajaj <poo...@openjdk.org> wrote:

> Please review this simple change that adds null checks for memory in 
> CgroupV1Subsystem.java.
> 
> Problem: After the backport of JDK-8250984,  there are places where 
> memory.isSwapEnabled() is called. For example:
> 
>     public long getMemoryAndSwapFailCount() {
>         if (!memory.isSwapEnabled()) {
>             return getMemoryFailCount();
>         }
>         return SubSystem.getLongValue(memory, "memory.memsw.failcnt");
>     }
>  
> But memory could be Null on some machines that have cgroup entries for CPU 
> but not for memory. This would cause a NullPointerException when memory is 
> accessed.
> 
> Fix: Add null checks for memory.

Changes look good!  Thanks for doing this.

Harold

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

Marked as reviewed by hseigel (Reviewer).

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

Reply via email to