RFR: 8305670: Performance regression in LockSupport.unpark with lots of idle threads

Daniel D. Daugherty dcubed at openjdk.org
Wed Apr 19 17:15:57 UTC 2023


On Wed, 19 Apr 2023 16:15:35 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> src/hotspot/share/prims/unsafe.cpp line 788:
>> 
>>> 786:     oop thread_oop = JNIHandles::resolve_non_null(jthread);
>>> 787:     if (java_lang_Thread::thread(thread_oop) != nullptr) {
>>> 788:       ThreadsListHandle tlh; // Provides memory barrier
>> 
>> I don't understand what the comment means - what kind of memory barrier?
>
> Store side do:
> Store to threadslist
> Store to eetop
> 
> Read side do:
> Read eetop
> Read threadslist
> Read eetop again
> 
> We want them to stay in this order.

Perhaps the comment should change to:

      ThreadsListHandle tlh; // Also is a barrier between the two JavaThread* queries.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13519#discussion_r1171630035


More information about the hotspot-runtime-dev mailing list