JDK-8133456 : HeapRegionManager::shrink_by() iterates suboptimally across regions
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u60,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-08-12
  • Updated: 2015-11-09
  • Resolved: 2015-08-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b81Fixed
Related Reports
Relates :  
Description
Noticed by kbarrett:

In line 431 of heapRegionManager.cpp, HeapRegionManager::shrink_by() the decrement while iterating over the heap region table is suboptimal, e.g. the "cur -= num_last_found;" statement.

If the recent scan had to skip over a block of !available || !empty regions to find the regions that were just removed, that skipped block isn't accounted for by that decrement.  I think a better iteration step would be "cur = idx_last_found;"

Comments
noreg-other justification: there are already quite a few of existing tests that check this (TestG1Shrink*, ArrayJuggle*)
24-08-2015

Suggesting P5 because the issue itself is a performance only issue. Impact seems very low because it only forces the code to scan entries in a table multiple times. The method is called only sometimes during full gc too. No workaround.
12-08-2015