RFR: 8334489: Add function os::used_memory [v2]
Erik Österlund
eosterlund at openjdk.org
Wed Jun 19 19:50:10 UTC 2024
On Wed, 19 Jun 2024 19:05:33 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> > Just for some context... I'm working on automatic heap sizing for ZGC. Part of the heuristics want to reason about some sort of "memory pressure" on the machine, which is vaguely related to what portion of the machine or container memory is used vs not used.
>
>
>
> That work is not supposed to also adjust to changing memory limits **at JVM runtime** is it? I'm not aware that the JVM is yet ready to do that.
>
>
>
> > Because we only expose free and available which depend on the container size. And to calculate the fraction I would have to ask for the container size again. If the two reported sizes are inconsistent, you are bound to get nonsense values.
>
>
>
> Why would they be inconsistent? Change the limit at JVM runtime?
Right. You can change the container size at JVM runtime, and I don't want to be caught off guard by that in my heuristics. There is an alpha kubernetes feature, InPlacePodVerticalScaling, for utilizing it already. So I much prefer doing the right thing and make this heuristic code robust in case someone starts using this.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19772#issuecomment-2179374885
More information about the hotspot-runtime-dev
mailing list