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

Aleksey Shipilev shade at redhat.com
Sun May 20 09:07:59 UTC 2018


On 05/20/2018 10:04 AM, Thomas Schatzl wrote:
> Webrev:
> http://cr.openjdk.java.net/~tschatzl/8203262/webrev

Looks good.

I would probably rename "old_capacity_until_GC" to just "old_value" to reduce noise and provide
visible symmetries. And avoided "actual" because it is confusing -- it is not an actual value anymore :)

E.g.:

2420   size_t old_value = _capacity_until_GC;
2421   size_t new_value = old_value + v;
2422
2423   if (new_value < old_value) {
2424     // The addition wrapped around, set new_value to aligned max value.
2425     new_value = align_down(max_uintx, Metaspace::commit_alignment());
2426   }
2427
2428   size_t res = Atomic::cmpxchg(new_value, &_capacity_until_GC, old_value);
2429
2430   if (old_value != res) {
2431     return false;
2432   }
2433
2434   if (new_cap_until_GC != NULL) {
2435     *new_cap_until_GC = new_value;
2436   }
2437   if (old_cap_until_GC != NULL) {
2438     *old_cap_until_GC = old_value;
2439   }
2440   return true;

-Aleksey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20180520/f64297ee/signature.asc>


More information about the hotspot-gc-dev mailing list