RFR: 8320318: ObjectMonitor Responsible thread

Fredrik Bredberg fbredberg at openjdk.org
Wed Sep 11 13:25:14 UTC 2024


On Tue, 10 Sep 2024 20:02:37 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Removed the concept of an ObjectMonitor Responsible thread.
>> 
>> The reason to have an ObjectMonitor Responsible thread was to avoid threads getting stranded due to a hole in the successor protocol. This hole was there because adding the necessary memory barrier was considered too expensive some 20 years ago.
>> 
>> The ObjectMonitor Responsible thread code adds complexity, and doing timed parks just to avoid getting stranded is not the way forward. More info about the problems with the ObjectMonitor responsible thread can be found in [JDK-8320318](https://bugs.openjdk.org/browse/JDK-8320318).
>> 
>> After removing the ObjectMonitor Responsible thread we see increased performance on all supported platforms except Windows. [JDK-8339730](https://bugs.openjdk.org/browse/JDK-8339730) has been created to handle this.
>> 
>> Passes tier1-tier7 on supported platforms.
>> x64, AArch64, Riscv64, ppc64le and s390x passes ok on the test/micro/org/openjdk/bench/vm/lang/LockUnlock.java test.
>> Arm32 and Zero doesn't need any changes as far as I can tell.
>
> src/hotspot/share/runtime/objectMonitor.cpp line 574:
> 
>> 572:   for (;;) {
>> 573:     if (own == DEFLATER_MARKER) {
>> 574:       if (TryLockI(current)) {
> 
> I can't tell the difference between TryLockI and enter_for().  Did I previously object to enter_for() here?  Maybe I should take that back, and there should be a comment above enter_for() like
>      // Enters a lock in behalf of a non-current thread, or a thread that is exiting and has previously given up the lock.
>      // and it handles deflation.
> 
> You could add a boolean that you expect success for the enter_for() caller from deoptimization (ie. must_succeed).
> 
> This code is getting repetitive - it looks the same in all these places only a little bit different and hard to know why.

Yes @coleenp, you did previously object to calling `enter_for()` from `TryLock()`,  which is why it is what it is today.
I'm not too proud of how it turned out, and as @dholmes-ora also pointed out , the naming is a bit confusing, so that needs to be fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1754511550


More information about the hotspot-dev mailing list