JDK-8319713 : Parallel: Remove PSAdaptiveSizePolicy::should_full_GC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-11-08
  • Updated: 2024-09-02
  • Resolved: 2023-11-28
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 JDK 21 JDK 22
17.0.13Fixed 21.0.4Fixed 22 b26Fixed
Related Reports
Relates :  
Relates :  
Description
Before starting young-gc (`PSScavenge::invoke`), we check if the upcoming yonug-gc should be upgraded to full-gc, based on history data (`PSScavenge::should_attempt_scavenge`), with the goal of avoiding promotion-failure during the upcoming young-gc.

After a successful young-gc, we check again (`PSAdaptiveSizePolicy::should_full_GC`) if a full-gc should follow to avoid future promotion-failure. (Ofc, if young-gc fails, we upgrade to full-gc.)

The after-success-young-gc check can be quite conservative; remove it to avoid unnecessary full-gc.

(The attachment shows a full-gc starts when it's not really needed. Running: `java -Xms3g -Xmx3g -XX:+UseParallelGC -XX:NewSize=1g pgc_full_gc.java`)
Comments
Added release-note=yes label to consider adding one for JDK 21.0.4 and 17.0.13.
02-09-2024

Hi Zhengyu, no I really meant this one.
22-08-2024

[~stuefe] I believe the above comment belongs to JDK-8328744.
21-08-2024

This change causes average heap occupancy to increase by reducing the number of GCs. Using heapothesys with Xmx=Xms=256m, a liveset size of 8MB and a allocation rate of 16MB, heap occupancy before this patch peaks at ~160MB, with this patch at ~200MB. While this is within parameters (max heap size is 256MB), it is a breaking change for some of our customers. Customers that tuned their memory settings for the old behaviour now run into OOM Kills since the GC behaviour changed. IMHO this should not have been downported for a minor release; and if, a clear release note would be helpful.
21-08-2024

Fix Request (17u) I would like to backport this patch to jdk17u, as a prerequisite for backport of JDK-8328744, which is a p2 bug. This is a low risk, clean backport that helps to reduce merge conflicts of JDK-8328744 backport.
08-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/2450 Date: 2024-05-07 16:57:41 +0000
07-05-2024

Fix Request (21u) I would like to backport this patch to jdk21u, as a prerequisite for clean backport of JDK-8328744, which is a p2 bug. This is a clean backport and risk is low.
26-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/536 Date: 2024-04-26 14:43:07 +0000
26-04-2024

Changeset: 4bcda602 Author: Albert Mingkun Yang <ayang@openjdk.org> Date: 2023-11-28 10:40:14 +0000 URL: https://git.openjdk.org/jdk/commit/4bcda602668835c35e2ac6ff6702d15cd249bc2a
28-11-2023

Running the attached bm: ``` ## baseline [0.003s][info][gc] Using Parallel [1.847s][info][gc] GC(0) Pause Young (Allocation Failure) 768M->953M(2944M) 857.598ms [3.480s][info][gc] GC(1) Pause Young (Allocation Failure) 1721M->1708M(2944M) 1497.325ms [6.580s][info][gc] GC(2) Pause Full (Ergonomics) 1708M->1399M(2944M) 3100.142ms ## new [0.002s][info][gc] Using Parallel [1.836s][info][gc] GC(0) Pause Young (Allocation Failure) 768M->952M(2944M) 850.014ms [3.436s][info][gc] GC(1) Pause Young (Allocation Failure) 1720M->1708M(2944M) 1466.434ms ``` Note the new version doesn't trigger full-gc any more.
13-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16560 Date: 2023-11-08 13:44:56 +0000
08-11-2023