RFR: 8263551: Provide shared lock-free FIFO queue implementation [v2]
Ivan Walulya
iwalulya at openjdk.java.net
Fri Mar 26 11:46:26 UTC 2021
On Tue, 16 Mar 2021 09:06:38 GMT, Man Cao <manc at openjdk.org> wrote:
>> Hi all,
>>
>> Could anyone review this change that is mainly code motion? It creates a generalized lock-free queue implementation based on G1DirtyCardQueueSet::Queue, which will be used by JDK-8236485 in the future.
>>
>> The shared LockFreeQueue is similar to the existing LockFreeStack. The notable difference is that the LockFreeQueue has an additional template parameter for whether to use GlobalCounter::CriticalSection to avoid ABA problem.
>>
>> -Man
>
> Man Cao has updated the pull request incrementally with one additional commit since the last revision:
>
> Address comment and add a gtest.
src/hotspot/share/utilities/lockFreeQueue.hpp line 33:
> 31:
> 32: // The LockFreeQueue template provides a lock-free FIFO. Its structure
> 33: // and usage is similar to LockFreeStack. It has inner paddings, and
probably need to add the conditional critical sections to the LockFreeStack for this description to be correct. But that can be done in a separate PR.
src/hotspot/share/utilities/lockFreeQueue.inline.hpp line 33:
> 31: #include "utilities/lockFreeQueue.hpp"
> 32: #include "logging/log.hpp"
> 33:
Don't we need inline specifiers for the functions below?
src/hotspot/share/utilities/lockFreeQueue.inline.hpp line 108:
> 106: // returns released objects to a free list for reuse, it could cause
> 107: // excessive allocations.
> 108: GlobalCounter::ConditionalCriticalSection<use_rcu> cs(use_rcu ?
` GlobalCounter::ConditionalCriticalSection<use_rcu> cs(Thread::current());` should be fine, not sure how much is gained by skipping the `Thread::current()` call.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2986
More information about the hotspot-gc-dev
mailing list