RFR: 8006971: More missing barriers in taskqueues for RMO architectures
david.holmes at oracle.com
Sat Aug 3 03:53:48 PDT 2013
On 2/08/2013 11:57 PM, Vladimir Danushevsky wrote:
> The issue of missing memory barriers in the GC taskqueue code was first flagged here:
> JDK7u40 fix for the same issue is located here:
> Initially we planned to port same solution to JDK8 however after reviewing the algorithm more we've started questioning a need for a full fence in between 'age' and 'bottom' elements. Since the intent is to keep 'bottom' memory reference from being executed before 'age' would a LoadLoad barrier (which in many cases is a cheaper solution) be sufficient? If so, the webrev below could possible be an adequate solution.
> We have tested both cases (fence and LL) on a hexa-core Power5 box running several test suites that currently expose the problem. The results are positive.
The loadload() should not be in any ifdef. The loadload() is part of the
algorithmic correctness. The loadload() will become a no-op on any
platform that does not need to do anything special to preserve the ordering.
> As a side note -
> perhaps it is possible to eliminate age/bottom potential reordering by loading both simultaneously through an Atomic class method. That would require though some structural changes to the layout of TaskQueueSuper class to align both fields together and ensure proper integer alignment (depending on 32/64-bit port), therefore this solution is less practical for the short term.
More information about the hotspot-dev