JDK-8214455 : Relocate CDS archived regions to the top of the G1 heap
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-11-28
  • Updated: 2021-05-25
  • Resolved: 2021-04-08
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 b18Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
When the runtime heap and dump time heap have different sizes, it's possible that the archived heap regions are mapped to the middle of the runtime heap. Because the archived heap regions are pinned, this could reduce the size of the largest "humongous" array allocation.

In the worst case, the maximum allocatable array length may be half of the optimal value.

The condition that needs to be changed is here:

https://github.com/openjdk/jdk/blob/104e925dfdac0af3b1c6862f9a7d3442484f9241/src/hotspot/share/memory/filemap.cpp#L1835

    if (!CompressedOops::is_in(range)) {
      log_info(cds)("CDS heap data need to be relocated because");
      log_info(cds)("the desired range " PTR_FORMAT " - "  PTR_FORMAT, p2i(range.start()), p2i(range.end()));
      log_info(cds)("is outside of the heap " PTR_FORMAT " - "  PTR_FORMAT, p2i(CompressedOops::begin()), p2i(CompressedOops::end()));
      _heap_pointers_need_patching = true;
>>>> Add
    } else if (header()->heap_end() != CompressedOops::end()) {
     log_info(cds)("CDS heap data need to be relocated to the end the runtime heap to reduce fragmentation");
  }
 <<<< end
Comments
Changeset: 78d1164c Author: Ioi Lam <iklam@openjdk.org> Date: 2021-04-08 00:41:28 +0000 URL: https://git.openjdk.java.net/jdk/commit/78d1164c
08-04-2021

Fix is needed for JDK-8239089
05-04-2021