Commit 0a577cd
committed
Fix PGC edenSurvivalRate overflow issue
The edenSurvivalRate is representing the number of regions out of those
allocated for this Eden which survived(typically 0.0 <= the Rate <=
1.0).
The edenSurvivalRate overflow (> 1.0) might cause incorrect Heap and
Eden size change(unexpected spike/noise) and for some cases might cause
zero free memory and trigger out of memory exception. the issue is not
regression, but just exposed by recent edenResize change(it might cause
indirect serious GC performance issues, but did not trigger any
crashes/exceptions/assertions).
There are two different overflow cases, one is major, another is minor.
Major issue is incorrect edenCountBeforeCollect.
During GC, the heap may expand to allow the current collection to
continue. A heap resize triggers an eden size recalculation without
allowing further heap expansion (heap reconfiguration). As a result,
the newly calculatedneden size can differ significantly from the eden
size at the start of the collection, causing the SurvivalRate
calculation to become inaccurate. Therefore, set
copyForwardStats->_edenEvacuateRegionCount (instead of
getCurrentEdenSizeInRegions(env)) to edenCountBeforeCollect.
Minor issue is _scanBytesEden double-counts.
When abort is in progress, every Eden object scanned in abort-recovery
contributes to _scannedBytes. But an object that was partially copied
before abort (the copy succeeded, the forwarding pointer was installed)
is also counted again during the abort scan of the source region.
So _scanBytesEden might be double-counted, then cause edenSurvivorCount
is bigger than edenCountBeforeCollect.
For this case, set edenSurvivorCount = edenCountBeforeCollect.
Signed-off-by: lhu <linhu@ca.ibm.com>1 parent f9113a3 commit 0a577cd
1 file changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
376 | 384 | | |
377 | 385 | | |
378 | 386 | | |
| |||
393 | 401 | | |
394 | 402 | | |
395 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
396 | 414 | | |
397 | 415 | | |
398 | 416 | | |
399 | 417 | | |
400 | 418 | | |
| 419 | + | |
401 | 420 | | |
402 | 421 | | |
403 | 422 | | |
| |||
0 commit comments