RFR: 8305994: Guarantee eventual async monitor deflation [v2]

Volker Simonis simonis at openjdk.org
Fri Apr 14 15:37:37 UTC 2023


On Fri, 14 Apr 2023 14:52:01 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/share/runtime/synchronizer.cpp line 1129:
>> 
>>> 1127:     // in normal conditions, so it should not count towards non-progress
>>> 1128:     // adjustments.
>>> 1129:     _no_progress_cnt = 0;
>> 
>> Not sure about this one? I understand your intention, but I think setting `_no_progress_cnt` to zero doesn't really improve things. If there will be deflations, `_no_progress_cnt` will be set to zero anyway (in `deflate_idle_monitors()`. However if there are no deflations, `_no_progress_cnt` will now always become `1`, even if it was higher before.
>> 
>> So maybe doing `--_no_progress_cnt` here would be more accurate?
>
> We don't know if this guaranteed deflation would make progress or not, so we cannot decrement blindly. In the new commit, I just introduced a new flag that disallows progress updates when we are in guaranteed deflation path.

The new code fixes it , but isn't it unnecessarily complex? In the previous version, when we made progress, `_no_progress_cnt` would have been reset to zero anyway, and if we didn't made progress, we would have just incremented `_no_progress_cnt` which would have reverted the previous decrement. Or am I missing something?

Anyway, I'm fine with both versions.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13474#discussion_r1166987383


More information about the hotspot-runtime-dev mailing list