JDK-8337828 : CDS: Trim down minimum GC region alignment
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-08-05
  • Updated: 2024-09-16
  • Resolved: 2024-08-21
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 24
24 b12Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8338856 :  
Description
CDS has a G1-dependent code block:

  // The minimum region size of all collectors that are supported by CDS in
  // ArchiveHeapLoader::can_map() mode. Currently only G1 is supported. G1's region size
  // depends on -Xmx, but can never be smaller than 1 * M.
  // (TODO: Perhaps change to 256K to be compatible with Shenandoah)
  static constexpr int MIN_GC_REGION_ALIGNMENT = 1 * M;

For Shenandoah, it would be indeed convenient to have that alignment to be trimmed to 256K. This would improve JDK-8293650.

Trimming down the min region alignment has impact on the size of the objects we can store in CDS archive. We need to explore if we hit a new threshold anywhere.
Comments
[~shade] - This fix has caused a regression: JDK-8338753 LotsOfClasses.java fails with fatal error: VM thread could block on lock that may be held by a JavaThread during safepoint: Heap_lock which causes two solid failures per Tier4 job set in the Oracle CI.
22-08-2024

Changeset: 59816975 Branch: master Author: Aleksey Shipilev <shade@openjdk.org> Date: 2024-08-21 08:17:01 +0000 URL: https://git.openjdk.org/jdk/commit/598169756c903bb1f77e35ea32717043bc166e3c
21-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20469 Date: 2024-08-05 17:41:41 +0000
05-08-2024

Aha! -Xlog:cds+heap handily prints the stats during -Xshare:dump for current JDK: % build/macosx-aarch64-server-fastdebug/images/jdk/bin/java -XX:-UseCompressedOops -Xlog:cds+heap -Xshare:dump ... [0.764s][info][cds,heap] 0 objects are <= 8 bytes (total 0 bytes, avg 0.0 bytes) [0.764s][info][cds,heap] 2550 objects are <= 16 bytes (total 40800 bytes, avg 16.0 bytes) [0.764s][info][cds,heap] 14325 objects are <= 32 bytes (total 431896 bytes, avg 30.1 bytes) [0.764s][info][cds,heap] 6572 objects are <= 64 bytes (total 301304 bytes, avg 45.8 bytes) [0.764s][info][cds,heap] 1225 objects are <= 128 bytes (total 113112 bytes, avg 92.3 bytes) [0.764s][info][cds,heap] 2173 objects are <= 256 bytes (total 384024 bytes, avg 176.7 bytes) [0.764s][info][cds,heap] 143 objects are <= 512 bytes (total 47720 bytes, avg 333.7 bytes) [0.764s][info][cds,heap] 40 objects are <= 1024 bytes (total 26872 bytes, avg 671.8 bytes) [0.764s][info][cds,heap] 19 objects are <= 2048 bytes (total 29656 bytes, avg 1560.8 bytes) [0.764s][info][cds,heap] 9 objects are <= 4096 bytes (total 20744 bytes, avg 2304.9 bytes) [0.764s][info][cds,heap] 4 objects are <= 8192 bytes (total 20536 bytes, avg 5134.0 bytes) [0.764s][info][cds,heap] 3 objects are <= 16384 bytes (total 30168 bytes, avg 10056.0 bytes) [0.764s][info][cds,heap] 2 objects are <= 32768 bytes (total 32800 bytes, avg 16400.0 bytes) [0.764s][info][cds,heap] 0 objects are <= 65536 bytes (total 0 bytes, avg 0.0 bytes) [0.764s][info][cds,heap] 1 objects are <= 131072 bytes (total 66848 bytes, avg 66848.0 bytes) [0.764s][info][cds,heap] 0 objects are <= 262144 bytes (total 0 bytes, avg 0.0 bytes) [0.764s][info][cds,heap] 0 huge objects (total 0 bytes, avg 0.0 bytes) [0.764s][info][cds,heap] 27066 total objects (total 1546480 bytes, avg 57.1 bytes) I think we are way below 256K, and trimming down the alignment would not miss any objects in current dump.
05-08-2024