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

Albert Mingkun Yang ayang at openjdk.org
Mon Aug 4 13:24:55 UTC 2025


On Mon, 4 Aug 2025 12:34:19 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - review
>>  - Merge branch 'master' into no-commit-stack-guard-page
>>  - no-commit-stack-guard-page
>
> 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.

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

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


More information about the hotspot-runtime-dev mailing list