RFR: JDK-8325139: JFR SwapSpace event - add free swap space information on Linux when running in a container environment [v7]

Severin Gehwolf sgehwolf at openjdk.org
Mon Mar 4 09:38:57 UTC 2024


On Fri, 1 Mar 2024 15:43:04 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> The JFR SwapSpace event (added by [JDK-8324287](https://bugs.openjdk.org/browse/JDK-8324287)) has been added but in a Linux containerized environment we currently just report -1, this should be enhanced. There is already some code in the mbeans (but in Java) that does something similar .
>
> Matthias Baesken has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - remove empty line is os_linux
>  - adjust os::free_swap_space Linux

Thanks for the updates! I think there are two things left to fix.

src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 182:

> 180:     } else {
> 181:       // no swap
> 182:       return 0;

Is this correct? It appears we ought to return `memory_usage_in_bytes()` in case of no swap.

test/hotspot/jtreg/containers/docker/TestJFREvents.java line 227:

> 225:             .shouldHaveExitValue(0)
> 226:             .shouldContain("totalSize = " + expectedTotalValue)
> 227:             .shouldContain("freeSize = " + expectedFreeValue);

This may return `freeSize = A` where `0 <= A <= totalSize`. I'd suggest to use a more lenient assertion.

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

Changes requested by sgehwolf (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17966#pullrequestreview-1913820959
PR Review Comment: https://git.openjdk.org/jdk/pull/17966#discussion_r1510865237
PR Review Comment: https://git.openjdk.org/jdk/pull/17966#discussion_r1510860995


More information about the hotspot-runtime-dev mailing list