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

David Holmes dholmes at openjdk.org
Fri Apr 28 05:40:53 UTC 2023


On Thu, 27 Apr 2023 16:17:20 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> src/hotspot/share/runtime/javaThread.cpp line 744:
>> 
>>> 742:   // allows the join() to complete once we've done the notify_all() below.
>>> 743:   // Needs a release() to obey Java Memory Model requirements (which is done
>>> 744:   // in set_thread()).
>> 
>> With the suggested renaming you don't need to add comments like this.
>
> Most of the comment isn't mine; I just updated it slightly and reformatted it. Is the
> mention of "Java Memory Model requirements" not a useful thing to note here?

Sorry I only meant your addition to the comment. The rest is important, if somewhat vague. The requirements is that if you call `t.isAlive()` and get false (because it has terminated) then you must see all stores performed by `t` before it terminated. We in part achieve this by marking `eetop` as a volatile field in the j.l.Thread object, hence the VM (technically) should always do a "volatile write" to it (i.e. release semantics). Conversely, reads of `eetop` from within the VM should have volatile-read semantics (i.e. acquire).

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

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


More information about the hotspot-runtime-dev mailing list