RFR(M): 8218049: Survivor MemoryMXBean used() size granularity is region based

Kim Barrett kim.barrett at oracle.com
Thu Apr 4 20:45:19 UTC 2019


> On Apr 4, 2019, at 2:35 PM, sangheon.kim at oracle.com wrote:
> 
> Hi Kim and Thomas,
> 
> On 4/4/19 11:08 AM, Kim Barrett wrote:
>>> For this change I suggest going back to use the subtract_until_zero()
>>> method (whether we use the racy region counts or the actual "used
>>> bytes" makes not difference with respect to the problem) and
>>> investigate improvements in a separate CR.
>> That seems like a reasonable plan.
> For other reviews: Kim, Thomas and I had separate discussion mostly suggestions from Kim to fix the inconsistency issue but we concluded to revert to use subtract_until_zero().
> 
> Here's the updated webrev which includes:
> 1) Remove newly added barriers and use subtract_until_zero():
>     I filed JDK-8221994 for further investigation.
> 2) Change indent at G1SurvivorRegions (from Kim)
> 
> http://cr.openjdk.java.net/~sangheki/8218049/webrev.3
> http://cr.openjdk.java.net/~sangheki/8218049/webrev.3_inc/
> 
> Thanks,
> Sangheon

------------------------------------------------------------------------------
src/hotspot/share/gc/g1/g1MonitoringSupport.cpp
 236   assert(_overall_used >= _eden_space_used + _survivor_space_used,
 237          "Overall used(" SIZE_FORMAT ") should be larger than or equal to sum(" SIZE_FORMAT ") of"
 238          " eden(" SIZE_FORMAT ") and survivor(" SIZE_FORMAT ")",
 239          _overall_used, _eden_space_used + _survivor_space_used,
 240          _eden_space_used, _survivor_space_used);
 241   _old_gen_used = subtract_up_to_zero(_overall_used, _eden_space_used + _survivor_space_used);

That (new) assert can fail because of inconsistent values. That's
pretty much the point of the careful subtraction.

Also, I wouldn't add (back) subtract_up_to_zero for just this use.
Instead, I suggest doing something like (with a comment about why)

  _old_gen_used = _overall_used - MIN2(_overall_used, _eden_space_used + _survivor_space_used);

------------------------------------------------------------------------------




More information about the hotspot-gc-dev mailing list