JDK-8254185 : Fix Code cache sweeper heuristics for JDK 11
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,11.0.10-oracle
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-07
  • Updated: 2020-12-22
  • Resolved: 2020-10-13
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 11
11.0.10-oracleFixed
Related Reports
Duplicate :  
Relates :  
Description
In JDK-8244660 I fixed the code cache sweeper for JDK 15. The same problem happens in 11 after back porting JDK-8244278: The sweeper doesn't run until the any of the code heaps are at least 90% full.

The cause are the mostly same: 
1) errors in the heuristic - _last_sweep is reset even when no sweep was done
2) missing notify of the sweeper thread that continues to sleep indefinitely. Both possibly_enable_sweep and updates of _time_counter are missing a call to notify.

In 15 and beyond we also can't rely on regular safepoints.

The fix for 8247775 doesn't apply cleanly on 11. I suggest a minimal fix instead of back porting.
Comments
URL: https://hg.openjdk.java.net/jdk-updates/jdk11u/rev/6014cad4d802 User: goetz Date: 2020-11-10 16:21:51 +0000
10-11-2020

I messed up and managed to push before maintainer approval. I will backout ASAP if needed. Formal request below: Fix Request RFR thread: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-October/003937.html This is partial backport of JDK-8244660 which doesn't apply cleanly at all. Motivation: The code cache sweeper has been badly broken since ~JDK9. JDK-8244278 fixes the problem that an "agggressive" code cache sweep is triggered for every code cache allocation (due to a mistake in the heuristic). But with the fix no code cache sweeps are done at all because the normal heuristic is broken too. JDK-8244660 fixes the normal sweeper heuristic in JDK 15. That patch doesn't apply cleanly on JDK 11. The patch is a partial (risk reduced) backport of JDK-8244660. It adds a call to notify the sweeper to wake up when the normal sweeper threshold has been reached, and moves the update of two fields that should have been inside the conditional block where a sweep has been performed. Testing: This has passes testing tier 1-6. I have also tested this patch together with JDK-8244278 and validated that the sweeper works as intended. Risk: Low. Abundant of testing and already in JDK15 (in a more evolved form).
13-10-2020

URL: https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/6014cad4d802 User: neliasso Date: 2020-10-13 08:29:39 +0000
13-10-2020

ILW = Same as JDK-8244660 = P3
08-10-2020