RFR: 8318817: Could not reserve enough space in CodeHeap 'profiled nmethods' (0K) [v2]

Daniel Lundén duke at openjdk.org
Tue Oct 31 08:26:32 UTC 2023


On Mon, 30 Oct 2023 17:11:15 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> @tstuefe: @dafedafe recommended that we ask you for advice on the above (possibly related to https://github.com/openjdk/jdk/pull/14903/). Do you know the details?
>
> Without looking deep into this, something about this feels off. The original code using os::vm_page_size() should work fine, at least on non-Windows.
> 
> On almost all platforms all three values are identical. On AIX ps can be smaller than os::vm_page_size, and you probably don't care. On Windows, allocation granularity is 64k while pagesize is 4K.

Thanks for the response Thomas! Indeed, the issue first surfaced on Windows where `os::vm_page_size()` < `os::vm_allocation_granularity()`. But, I have also been able to reproduce the issue on Linux with, e.g., `-XX:NMethodSizeLimit=351658240 -XX:+UseTransparentHugePages` which makes `ps` > `os::vm_page_size()`.

The proposed `MAX3` solution above is a safe approximation. However, it may also be safe to use `MAX2(os::vm_allocation_granularity(), ps)` (as Roberto suggests) if `os::vm_page_size()` is never the maximum. Even if `ps` >= `os::vm_page_size()` is not always true, maybe `os::vm_allocation_granularity()` >= `os::vm_page_size()` is always true?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16373#discussion_r1377208999


More information about the hotspot-compiler-dev mailing list