JDK-8242032 : G1 region remembered sets may contain non-coarse level PRTs for already coarsened regions
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 15
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-04-02
  • Updated: 2021-03-02
  • Resolved: 2021-02-22
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 17
17 b11Fixed
Related Reports
Relates :  
Relates :  
Description
The code in add_reference to add a remembered set looks as follows:

X = ... from-region-of-added-card
if (already coarsened(X)) {
  exit;
}

...

MutexLocker x(...)

if (region X in sparse PRT) {
  add card for region X in sparse PRT
  exit
}
...
maybe coarsen PRT for region X

The problem is that while one thread is in the mutex-guarded region, other threads that also want to add a card to PRT for region X might get blocked on the mutex. If the original thread now coarsens the PRT for region X, and the other threads for get into it, they will find that there is no fine and sparse PRT for X, so create a new one.

The code in the mutex guarded section should also check whether the region X has already been coarsened or not.

Apart from memory waste (and minor miscounting of occupied cards) this is benign.

This is a day one bug afaik.
Comments
Changeset: a6a7e439 Author: Joakim Nordstr��m <joakim.nordstrom@oracle.com> Committer: Thomas Schatzl <tschatzl@openjdk.org> Date: 2021-02-22 16:16:59 +0000 URL: https://git.openjdk.java.net/jdk/commit/a6a7e439
22-02-2021