PING: RFR: 8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize

Thomas Schatzl thomas.schatzl at oracle.com
Wed Jan 30 12:55:52 UTC 2019


On Wed, 2019-01-30 at 21:49 +0900, Yasumasa Suenaga wrote:
> Hi Thomas,
> 
> > >     http://cr.openjdk.java.net/~ysuenaga/JDK-8217432/webrev.01/
> > > 
> > > I write reply based on it as below.
> 
> > > I added the code to check total amount of _capacity_until_GC
> > > before inc_capacity_until_GC() call.
> > > But I concern the check and increment are not atomically. Is it
> > > okay?
> > 
> > If the check were located after the Atomic::cmpxchg() and after the
> > check whether it had been this thread to change the value it would
> > be
> > fine :)
> 
> Do you suggest as following code?

No, in MetaspaceGC::inc_capacity_until_GC() after the cmpxchg and the
check whether this thread has been the one incrementing the watermark.

I.e. "

size_t prev_value = Atomic::cmpxchg(new_value, ...);

if (old_capacity_until_gc != prev_value) {
  return false; // Somebody else incremented the counter
}

assert(new_value <= MaxMetaspaceSize, "...

"

At that point in execution we are sure this thread set "new_value" to a
new value, that should obviously not exceed MaxMetaspaceSize.

Please use a meaningful assert text containing the increment, new value
and threshold.

Thanks,
  Thomas




More information about the hotspot-gc-dev mailing list