RFR: 8284900: Check InitialHeapSize and container memory limits before startup [v8]

Severin Gehwolf sgehwolf at openjdk.java.net
Thu Apr 21 12:12:26 UTC 2022


On Thu, 21 Apr 2022 12:08:22 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> @jerboaa Good point. Also take a look at Arguments::set_heap_size() and how that function uses os::physical_memory() and also limit_heap_by_allocatable_memory(). It seems like any change in GCArguments should go hand-in-hand with the code in set_heap_size.
>
>> > Perhaps we should generalize this to use `os::physical_memory()` here instead of the Linux-specific `OSContainer` API? `os::physical_memory()` would return the container limit if it detects so.
>> 
>> What will happen with `-Xms7G` on a machine configured with 4G physical memory + 4G swap space? Does `os::physical_memory()` return `physical memory + swap space size`?
> 
> It doesn't. What would happen on a physical machine, though? It should really do the same thing regardless of the container settings. Container settings, in a nutshell, should be an abstraction of "physical" host. Otherwise behave the same. Having said that, in containers (at least kubernetes) swap is usually disabled. Also, does it make sense to allow `-Xms7g` on a system with `4G` of physical RAM? I'm doubtful.

> @jerboaa Good point. Also take a look at Arguments::set_heap_size() and how that function uses os::physical_memory() and also limit_heap_by_allocatable_memory(). It seems like any change in GCArguments should go hand-in-hand with the code in set_heap_size.

+1

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

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



More information about the hotspot-gc-dev mailing list