RFR: 8312132: Add tracking of multiple address spaces in NMT [v89]

Johan Sjölen jsjolen at openjdk.org
Fri May 17 08:08:15 UTC 2024


On Thu, 16 May 2024 21:04:49 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Add corresponding tests to visit_in_order when applicable
>>  - Remove usage of auto in tests
>
> src/hotspot/share/nmt/nmtTreap.hpp line 175:
> 
>> 173: #ifdef ASSERT
>> 174:   void verify_self() {
>> 175:     const double expected_maximum_depth = log(this->_node_count+1) * 5;
> 
> Where did 5 come from, shouldn't this be:
> 
> `    const double expected_maximum_depth = log(this->_node_count+1) * (this->_node_count+1)
> `
> ?

The depth of a binary tree is on the order of `log(n)`, "the order of" is important here. Essentially, we need some wiggle room. I found that 3 fails, so I bumped it to 5. This did cause me to investigate whether we can pick a tighter bound, and `3.5` fits as long as we perform `ceil` instead of `floor` on the result.

I'll comment where the constant comes from.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18289#discussion_r1604520911


More information about the hotspot-dev mailing list