RFR: 8233061: ZGC: Enforce memory ordering in segmented bit maps
erik.osterlund at oracle.com
erik.osterlund at oracle.com
Fri Nov 8 14:51:15 UTC 2019
Hi Per,
Thanks for the review.
/Erik
On 11/8/19 2:38 PM, Per Liden wrote:
>
> On 10/28/19 4:53 PM, Erik Österlund wrote:
>> Hi,
>>
>> In ZGC, bitmaps are lazily cleared in a segmented fashion. In this
>> scheme, liveness is determined by looking at a counter, a segment bit
>> map and finally the flat bit map structure. The accesses for the
>> various stages need to be ordered properly. This patch sprinkles some
>> OrderAccess calls to enforce this ordering.
>>
>> Out of curiosity, I disassembled libjvm.so with and without this
>> patch to see if the reordering has bitten us in practice on x86_64.
>> Fortunately, according to my analysis, it has not; we seem to have
>> been lucky. But there is a lot of machine code, so I could have
>> missed something. However, given that we now have an AArch64 port
>> which is definitely affected by this problem, and compilers really
>> are free to do whatever they want to in the future, it seems in order
>> to enforce this explicitly.
>>
>> This patch depends on
>> https://bugs.openjdk.java.net/browse/JDK-8233073 which exposes some
>> memory ordering aware getters on BitMap. I did not want to just wrap
>> the existing API in ZGC, so I split that out to a separate RFE.
>>
>> CR:
>> http://cr.openjdk.java.net/~eosterlund/8233061/webrev.00/
>
> The rebased webrev.01 looks good.
>
> /Per
>
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8233061
>>
>> Thanks,
>> /Erik
More information about the hotspot-gc-dev
mailing list