RFR: 8280832: Update usage docs for NonblockingQueue

Kim Barrett kbarrett at openjdk.java.net
Wed Feb 9 04:20:10 UTC 2022


On Wed, 9 Feb 2022 00:39:34 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Please review this update of the usage and implementation comments for
>> NonblockingQueue to discuss the ABA issue in push/append operations.
>
> 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.

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

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


More information about the hotspot-dev mailing list