RFR: 8332506: SIGFPE In ObjectSynchronizer::is_async_deflation_needed() [v3]
Fredrik Bredberg
fbredberg at openjdk.org
Tue Jan 7 12:46:09 UTC 2025
On Tue, 7 Jan 2025 01:04:50 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> But `monitors_used == list->count()` and `list->count()` by definition must be <= `list->max()`, so including `monitors_used` in the `MAX3` expression is pointless.
>>
>> EDIT: UGGGHHH! Now I see, because `MonitorList::add` is lock-free we can have count race far ahead of max! Oh that is awful in respect of the current code trying to use both values to decide what to do. :(
>
> In which case may I suggest the following comment:
>
> // Make sure that we use a ceiling value that is not lower than previous, not lower
> // than the recorded max used by the system, and not lower than the current number of
> // monitors in use (which can race ahead of max). The result is guaranteed > 0.
Added your suggested comment @dholmes-ora .
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22815#discussion_r1905399318
More information about the hotspot-runtime-dev
mailing list