RFR (XS): 8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC

Thomas Schatzl thomas.schatzl at oracle.com
Sun May 20 08:04:36 UTC 2018


Hi all,

  can I have reviews for this small change that removes a faulty reload
of the expected value for some atomic cmpxchg use?

I.e. the code is like this:

old = _value;

new = old + ...

... = Atomic::cmpxchg(new, &_value, _value);

It is generally wrong to reload _value as expected value in the cmpxchg
because it might have changed between the its initial load and the use
in cmpxchg.

This defect has been found by code inspection, there has been no issue
reported because of this.

CR:
https://bugs.openjdk.java.net/browse/JDK-8203262
Webrev:
http://cr.openjdk.java.net/~tschatzl/8203262/webrev
Testing:
hs-tier1-3

Thanks,
  Thomas




More information about the hotspot-gc-dev mailing list