RFR: 8346123: [REDO] NMT should not use ThreadCritical [v6]

Thomas Stuefe stuefe at openjdk.org
Fri Dec 20 18:26:50 UTC 2024


On Fri, 20 Dec 2024 17:45:21 GMT, Robert Toyonaga <duke at openjdk.org> wrote:

>> There's a few other is_bootstrapping() predicates in the code like Universe::is_bootstrapping.  This might read nicely as is_bootstrapping_done() and the instance is _bootstrapping_done.
>
> Ok I've updated everything to use "bootstrapping_done" instead of "done_bootstrap"

Arguably, MemTracker is the wrong place anyway since the problem it tries to solve is not tied to NMT initialization.

The thought behind the "bootstrap_done" was to make visible that it is safe to not lock since we still run effectively single-threaded. Hotspot loading and CreateJavaVM may happen on different threads, but not at the same time.

We can delay real locking until other threads are starting up. That is somewhere in the middle of VM initialization, but long after NMT has booted. But we can do it also as soon as Mutex initialization is done. 

So we could either move this to the mutex layer and give us a "MutexLocker::all_initialised". In that case, the implicit assumption is that as long as the JVM initializes this before other threads are started. Or, we could move it to the thread subsystem and give us a marker for when we are not single-threaded anymore. I like the former better.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22745#discussion_r1894256355


More information about the hotspot-dev mailing list