On Sat, 24 Dec 2022 04:14:07 GMT, Serguei Spitsyn <[email protected]> wrote:
>> Now the `JvmtiVTMSTransitionDisabler` mechanism supports disabling VTMS
>> transitions for all virtual threads only. It should also support disabling
>> transitions for any specific virtual thread as well. This will improve
>> scalability of the JVMTI functions operating on target virtual threads as
>> the functions can be executed concurrently without blocking each other
>> execution when target virtual threads are different.
>> New constructor `JvmtiVTMSTransitionDisabler(jthread vthread)` is added
>> which has jthread parameter of the target virtual thread.
>>
>> Testing:
>> mach5 jobs are TBD (preliminary testing was completed):
>> - all JVMTI, JDWP, JDI and JDB tests have to be run
>> - Kitchensink
>> - tier5
>
> Serguei Spitsyn has updated the pull request incrementally with one
> additional commit since the last revision:
>
> fix race between VTMS_transition_disable_for_one and start_VTMS_transition
Hi Serguei,
I looked at the latest changes and it all looks good to me. Thanks!
Patricio
src/hotspot/share/prims/jvmtiThreadState.cpp line 376:
> 374: Atomic::dec(&_VTMS_transition_disable_for_one_count);
> 375: if (_VTMS_transition_disable_for_one_count == 0 || _is_SR) {
> 376: ml.notify_all();
I was going to say that we don't really need the global
_VTMS_transition_disable_for_one_count since we can notify here if
java_lang_Thread::VTMS_transition_disable_count(vth()) is zero, which is what
the target checks. But I realized everybody uses the same lock so we would be
notifying everybody. Using _VTMS_transition_disable_for_one_count as it is at
least we notify everybody at once when there are no more single disablers. Not
sure if that was the purpose, otherwise I think we could remove it.
src/hotspot/share/prims/jvmtiThreadState.cpp line 479:
> 477:
> 478: // Unblock waiting VTMS transition disablers.
> 479: if (_VTMS_transition_disable_for_one_count > 0 ||
In here it would actually be the other way. If we would check
java_lang_Thread::VTMS_transition_disable_count(vth()) > 0 instead of the
global _VTMS_transition_disable_for_one_count we would avoid the notify in case
there are singler disablers waiting but not for this thread.
-------------
Marked as reviewed by pchilanomate (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11690