RFR: 8253064: monitor list simplifications and getting rid of TSM [v4]
Daniel D.Daugherty
dcubed at openjdk.java.net
Tue Nov 10 23:33:59 UTC 2020
On Tue, 10 Nov 2020 23:15:15 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Ahhh... I think I understand your confusion. This line:
>>
>> L550: // Deferred decrement for the JT EnterI() that cancelled the async deflation.
>> L551: add_to_contentions(-1);
>>
>> doesn't match up with this line:
>>
>> L361: add_to_contentions(1);
>>
>> It matches up with one of these:
>> if (try_set_owner_from(DEFLATER_MARKER, Self) == DEFLATER_MARKER) {
>> // Cancelled the in-progress async deflation by changing owner from
>> // DEFLATER_MARKER to Self. As part of the contended enter protocol,
>> // contentions was incremented to a positive value before EnterI()
>> // was called and that prevents the deflater thread from winning the
>> // last part of the 2-part async deflation protocol. After EnterI()
>> // returns to enter(), contentions is decremented because the caller
>> // now owns the monitor. We bump contentions an extra time here to
>> // prevent the deflater thread from winning the last part of the
>> // 2-part async deflation protocol after the regular decrement
>> // occurs in enter(). The deflater thread will decrement contentions
>> // after it recognizes that the async deflation was cancelled.
>> add_to_contentions(1);
>>
>> The long comments are in the two places where we temporarily
>> increment contentions to stop the race with the deflater thread
>> and the shorter comment, e.g., L550, are for where we undo the
>> temporary increment.
>>
>> The primary purpose of the contentions field is for JVM/TI and
>> M&M queries. We just (temporarily) steal it for async deflation
>> purposes...
>
> Well since it controls async deflation, it should probably get a mention since this comment on its own is not true:
>
> // Keep track of contention for JVM/TI and M&M queries and control async deflation.
>
> The field _contentions has a good comment.
The comment for **that** location is correct. That's the location
where we keep track of contended monitors for JVM/TI and M&M.
The comments at the other locations are also correct (very verbose
for two of them, but correct).
-------------
PR: https://git.openjdk.java.net/jdk/pull/642
More information about the serviceability-dev
mailing list