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

Johan Sjölen jsjolen at openjdk.org
Tue May 21 16:17:14 UTC 2024


On Tue, 21 May 2024 15:21:59 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix copyright
>
> src/hotspot/share/nmt/nmtTreap.hpp line 98:
> 
>> 96:     _prng_seed = (PrngMult * _prng_seed + PrngAdd) & PrngModMask;
>> 97:     return _prng_seed;
>> 98:   }
> 
> We are now adding a 3rd standalone identical implementation, there are 2 already in:
> 
> - ThreadHeapSampler::next_random()
> - JfrPRNG::next_uniform()
> 
> Perhaps it's high time to consider moving this into `share/utilities` ?

I agree, let's make a separate RFE for that. I'm keeping track of the instances where I've said that, so we shouldn't miss those opportunities :-).

> src/hotspot/share/nmt/nmtTreap.hpp line 226:
> 
>> 224: 
>> 225: public:
>> 226:   Treap(uint64_t seed = static_cast<uint64_t>(os::random()))
> 
> Do we need 64 bit random number here? If we really need 64 bits shouldn't we do something like:
> 
> `  Treap(uint64_t seed = static_cast<uint64_t>(os::random())) | (static_cast<uint64_t>(os::random())) << 32)`
> 
> or add `os::random_62bits()` that does exactly this?
> 
> Notice that I filed https://bugs.openjdk.org/browse/JDK-8332618 asking to rename `os::random() `to `os::random_31bits()`, so this would go nicely with that change later.

I just want to get as much entropy as possible. Yeah, let's do the bit shift inline for now

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

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


More information about the hotspot-dev mailing list