RFR: 8263476: NMT: Stack guard pages should not be marked as committed [v2]

Johan Sjölen jsjolen at openjdk.org
Mon Aug 4 13:56:00 UTC 2025


On Mon, 4 Aug 2025 13:22:25 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 3455:
>> 
>>> 3453: 
>>> 3454:     if (stack_extent < (uintptr_t)addr + size) {
>>> 3455:       ::munmap((void*)stack_extent, (uintptr_t)(addr + size - stack_extent));
>> 
>> Could you explain this, is it fixing a pre-existing bug as well?
>
> There is no pre-existing bug. The previous code ensures the memory range for stack-guard-pages are committed, note `os::commit_memory` is invoked in all paths. OTOH, the "reserve memory" call is only for main-thread in the new code. Also added a diagram, if that helps.

Aha, now I understand. The diagram helped a lot!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26571#discussion_r2251557854


More information about the hotspot-runtime-dev mailing list