RFR: 8321931: memory_swap_current_in_bytes reports 0 as "unlimited" [v5]

Gerard Ziemski gziemski at openjdk.org
Mon Jan 22 17:20:44 UTC 2024


On Mon, 22 Jan 2024 14:04:47 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> > I chose to check that `unlimited` does not appear with `memory_swap_current_in_bytes` on the same line, not for `0` to exist, since it's possible that the current memory swap might be > 0, at some point later in the future.
> 
> Why? If a container is being run with `--memory X` and `--memory-swap X` (`X` being the same value) then there must not be any swap used, so any value greater than `0` would be a bug and the assertion is safe. See https://docs.docker.com/config/containers/resource_constraints/#prevent-a-container-from-using-swap

This bug fix is correcting the behavior where `0` should be displayed instead of `unlimited`. Strictly speaking that's all we need to test here. The test I proposed uses an approach that is flexible enough in case that this value happens to be greater than `0` in the future for any reason.

I'd really prefer to keep the test as simple as possible to cover this specific fix, which in my opinion it does.

Setting  `--memory X` and `--memory-swap X` introduces more variables and makes the test more complicated than it needs to be, in my opinion.

What do you think?

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

PR Comment: https://git.openjdk.org/jdk/pull/17314#issuecomment-1904448978


More information about the hotspot-runtime-dev mailing list