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

Daniel Lundén duke at openjdk.org
Tue Oct 31 11:38:33 UTC 2023


On Tue, 31 Oct 2023 10:50:59 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> 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?
>
>> maybe os::vm_allocation_granularity() >= os::vm_page_size() is always true?
> 
> I just checked and this holds on Windows (64 bits): `os::vm_page_size()` gives 4K and `os::vm_allocation_granularity()` gives 64K regardless of whether `UseLargePages` is set (this option affects the value of `ps` only). On all other OS:es we have `os::vm_allocation_granularity() == os::vm_page_size()` so it should be safe to remove `os::vm_page_size()`, right?
> Perhaps you can remove it but add an assertion that it is always equal or smaller to `MAX2(os::vm_allocation_granularity(), ps)`.
> Also, I think it would be good to include a Windows-specific test case to exercise the case where `os::vm_allocation_granularity() != os::vm_page_size()`, would this be possible?

I'm fine with changing to MAX2 and adding an assert. There is already a test case that runs on all operating systems (including Windows where granularity != page size), that should be sufficient?

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

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


More information about the hotspot-compiler-dev mailing list