RFR: 8351661: NMT: VMATree should support separate call-stacks for reserve and commit operations [v29]

Gerard Ziemski gziemski at openjdk.org
Wed May 21 19:46:58 UTC 2025


On Wed, 21 May 2025 10:15:15 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> In NMT detail mode, we need to have separate call-stacks for Reserve and Commit operations.
>> This PR adds a second stack to every node that will be used when committing (and uncommitting) the start node of a reserved region.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed a missed change in test.

For this case:


  {// Check committing into a reserved region inherits the call stacks
    VMATree::RegionData call_stack_test(si_1, mtTest);
    VMATree::RegionData call_stack_none(si_2, mtNone);
    VMATree::RegionData call_stack_nmt(si_2, mtNMT);
    Tree tree;
    tree.reserve_mapping(0, 50, call_stack_test); // reserve in an empty tree
    tree.commit_mapping(25, 10, call_stack_nmt, true); // commit at the middle of the region
    tree.print_timeline_on();
  }


I know that we are passing `true` for `use_tag_inplace` here,  but it just does not feel right to get this:

 ```
           1         2         3         4         5         6
0123456789012345678901234567890123456789012345678901234567890123456789
AAAAAAAAAAAAAAAAAAAAAAAAAbbbbbbbbbbCCCCCCCCCCCCCCC....................
Legend:
A - Test (reserved)
b - Test (committed)
C - Test (reserved)
. - None (free/released)


I was expecting this:

 ```
           1         2         3         4         5         6
0123456789012345678901234567890123456789012345678901234567890123456789
AAAAAAAAAAAAAAAAAAAAAAAAAbbbbbbbbbbCCCCCCCCCCCCCCC....................
Legend:
A - Test (reserved)
b - Native Memory Tracking (committed)
C - Test (reserved)
. - None (free/released)


I don't think we should be allowing `use_tag_inplace` to modify the behavior this much. Instead of `use_tag_inplace` we could accept mtNone to inherit the tag already in place? No need for that extra parameter?

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

PR Comment: https://git.openjdk.org/jdk/pull/24028#issuecomment-2899055965


More information about the hotspot-runtime-dev mailing list