RFR: JDK-8256844: Make NMT late-initializable
Zhengyu Gu
zgu at openjdk.java.net
Fri Jul 30 16:39:31 UTC 2021
On Fri, 30 Jul 2021 16:28:54 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/services/nmtPreInit.hpp line 202:
>>
>>> 200: assert((*aa) != NULL, "Entry not found: " PTR_FORMAT, p2i(p));
>>> 201: NMTPreInitAllocation* a = (*aa);
>>> 202: (*aa) = (*aa)->next; // remove from its list
>>
>> Could this be a race? There is no synchronization, read/write result could be arbitrary.
>
> The code is implicitly thread-safe because the hashmap is only modified in the pre-NMT-init phase. After NMT initialization, the table is read-only. During pre-NMT-init we are effectively single-threaded - at most two threads access the map, the thread loading the libjvm, and the thread calling CreateJavaVM, but not at the same time.
>
> See also the asserts in the AllStatic class `NMTPreInit`.
>
> (I should have described it more clearly, will add a comment.)
So, you are saying that there is no memory that is malloc'd pre-NMT-init phase and freed post-NMT-init phase?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4874
More information about the hotspot-dev
mailing list