RFR: 8280832: Update usage docs for NonblockingQueue [v2]

David Holmes dholmes at openjdk.java.net
Thu Feb 10 06:29:09 UTC 2022


On Wed, 9 Feb 2022 04:16:33 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/utilities/nonblockingQueue.inline.hpp line 122:
>> 
>>> 120:     // try_pop could take old_tail before our update, it gets recycled and
>>> 121:     // re-added to the end, and then we successfully cmpxchg, rendering the
>>> 122:     // list in _tail circular.
>> 
>> Doesn't this contradict the "We won any races with try_pop ... so we're done"!
>
> The client of this class is expected to prevent ABA from occurring.  Some of the mechanisms that might be used for doing so include separate phases for push/pop and preventing recycling while some thread might be in the midst of one of the problem operations.  The only current user of this class is G1DirtyCardQueueSet, where a combination of GlobalCounter critical sections and safepoint boundaries are used to ensure ABA can't happen.

Understood, but it still, to me, reads oddly to claim "we're done" and then have an ABA disclaimer.

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

PR: https://git.openjdk.java.net/jdk/pull/7393


More information about the hotspot-dev mailing list