RFR: 8317049: GenShen: Very rare loss of function for ShenandoahControlThread::_regulator_lock

Kelvin Nilsen kdnilsen at openjdk.org
Thu Sep 28 17:12:52 UTC 2023


We have observed that we very rarely miss _regulator_lock notifications.  We have identified the root cause to be a race, which occurs when the ShenandoahControlThread notifies the _regulator_lock before the ShenandoahRegulatorThread has begun to wait for the notification.

This change forces the ShenandoahControlThread to wait until the ShenandoahRegulatorThread is inside its wait() invocation.  It does so by acquiring the Mutator lock for _regulator_thread before notifying the control thread.  The control thread must acquire this lock before it can notify.  The control thread will not be able to acquire the lock until the regulator thread releases the lock by invoking ml.wait().

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

Commit messages:
 - Force control thread to wait until regulator ready to receive notify

Changes: https://git.openjdk.org/shenandoah/pull/332/files
 Webrev: https://webrevs.openjdk.org/?repo=shenandoah&pr=332&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8317049
  Stats: 11 lines in 1 file changed: 8 ins; 3 del; 0 mod
  Patch: https://git.openjdk.org/shenandoah/pull/332.diff
  Fetch: git fetch https://git.openjdk.org/shenandoah.git pull/332/head:pull/332

PR: https://git.openjdk.org/shenandoah/pull/332


More information about the shenandoah-dev mailing list