RFR: 8328944: NMT reports "unknown" memory [v2]

Afshin Zafari azafari at openjdk.org
Wed Nov 20 10:06:26 UTC 2024


On Sat, 16 Nov 2024 02:52:18 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> src/hotspot/share/memory/virtualspace.hpp line 67:
>> 
>>> 65: 
>>> 66:   void reserve(size_t size, size_t alignment, size_t page_size,
>>> 67:                char* requested_address, bool executable, MemTag mem_tag);
>> 
>> Why do the instance methods get MemTag? Why is MemTag not stored as a (const) attribute of ReservedSpace? 
>> 
>> But then, we would have double accounting - we'd store the tag both in NMT and in ReservedSpace instances. If we change them post-reservation, we would need to change both. Sigh.
>> 
>> So we pass in MemTag just for the ReservedSpace to pass it into os::reserve_memory. Seeing how often ReservedSpace is used in situations where the tag is not clear at reservation time, I wonder whether we are not better off letting the user of ReservedSpace register the NMT tag post reservation like they do today.
>
> I like the simplicity of not having to deal with changing the tag afterwards personally. Does anyone else have an opinion here?

We need to keep a member MemTag for ReservedSpace. There are cases in the code where a new copy of a ReservedSpace is to be created. Then, we need to know the original MemTag and pass it again down to the other functions.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21843#discussion_r1850001690


More information about the shenandoah-dev mailing list