JDK-8214280 : FileMapInfo::map_heap_regions_impl fails to relocate archive regions to runtime heap top in some cases
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2018-11-24
  • Updated: 2020-08-19
  • Resolved: 2020-01-21
Related Reports
Relates :  
Relates :  
Description
Stefan Johansson reported that the archive heap regions are not relocated to the runtime heap top in following case:

bin/java -Xlog:cds,region*=trace -Xmx64m -XX:G1HeapRegionSize=2m -version
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fc000000, 0x00000000fc000000, 0x00000000fc200000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fc200000, 0x00000000fc200000, 0x00000000fc400000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fc400000, 0x00000000fc400000, 0x00000000fc600000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fc600000, 0x00000000fc600000, 0x00000000fc800000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fc800000, 0x00000000fc800000, 0x00000000fca00000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fca00000, 0x00000000fca00000, 0x00000000fcc00000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fcc00000, 0x00000000fcc00000, 0x00000000fce00000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fce00000, 0x00000000fce00000, 0x00000000fd000000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fd000000, 0x00000000fd000000, 0x00000000fd200000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fd200000, 0x00000000fd200000, 0x00000000fd400000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fd400000, 0x00000000fd400000, 0x00000000fd600000]
[0.029s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fd600000, 0x00000000fd600000, 0x00000000fd800000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fd800000, 0x00000000fd800000, 0x00000000fda00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fda00000, 0x00000000fda00000, 0x00000000fdc00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fdc00000, 0x00000000fdc00000, 0x00000000fde00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fde00000, 0x00000000fde00000, 0x00000000fe000000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fe000000, 0x00000000fe000000, 0x00000000fe200000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fe200000, 0x00000000fe200000, 0x00000000fe400000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fe400000, 0x00000000fe400000, 0x00000000fe600000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fe600000, 0x00000000fe600000, 0x00000000fe800000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fec00000, 0x00000000fec00000, 0x00000000fee00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000fee00000, 0x00000000fee00000, 0x00000000ff000000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ff000000, 0x00000000ff000000, 0x00000000ff200000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ff200000, 0x00000000ff200000, 0x00000000ff400000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ff400000, 0x00000000ff400000, 0x00000000ff600000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ff600000, 0x00000000ff600000, 0x00000000ff800000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ff800000, 0x00000000ff800000, 0x00000000ffa00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ffa00000, 0x00000000ffa00000, 0x00000000ffc00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ffc00000, 0x00000000ffc00000, 0x00000000ffe00000]
[0.030s][trace][gc,region] G1HR COMMIT(FREE) [0x00000000ffe00000, 0x00000000ffe00000, 0x0000000100000000]
[0.030s][trace][gc,alloc,region] Mutator Alloc Region: 0 NULL : initializing
[0.030s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : initialized
[0.031s][info ][cds            ] CDS archive was created with max heap size = 128M, and the following configuration:
[0.031s][info ][cds            ]     narrow_klass_base = 0x0000000800000000, narrow_klass_shift = 3
[0.031s][info ][cds            ]     narrow_oop_mode = 0, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 0
[0.031s][info ][cds            ] The current max heap size = 64M, HeapRegion::GrainBytes = 2097152
[0.031s][info ][cds            ]     narrow_klass_base = 0x0000000800000000, narrow_klass_shift = 3
[0.031s][info ][cds            ]     narrow_oop_mode = 0, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 0
[0.031s][info ][cds            ] CDS heap data relocation delta = 0 bytes
[0.031s][info ][cds            ] CDS heap data need to be relocated lower by a further 1048576 bytes to -1048576 to be aligned with HeapRegion::GrainBytes
[0.031s][info ][cds            ] Trying to map heap data: region[5] at 0x00000000ffc00000, size =   462848 bytes
[0.031s][trace][gc,region      ] G1HR ALLOC(CARC) [0x00000000ffc00000, 0x00000000ffc00000, 0x00000000ffe00000]
[0.031s][info ][cds            ] Trying to map heap data: region[7] at 0x00000000ffb00000, size =   278528 bytes
[0.031s][trace][gc,region      ] G1HR ALLOC(OARC) [0x00000000ffa00000, 0x00000000ffa00000, 0x00000000ffc00000]
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : alloc failed min 256 desired 62916
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : alloc failed min 62916 desired 62916
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : retiring
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : retired
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : attempting region allocation
[0.070s][trace][gc,region      ] G1HR ALLOC(EDEN) [0x00000000ffe00000, 0x00000000ffe00000, 0x0000000100000000]
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 0 DUMMY : update
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 1 31:(E)[0x00000000ffe00000,0x00000000ffe7ae20,0x0000000100000000] : updated
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 1 31:(E)[0x00000000ffe00000,0x00000000ffe7ae20,0x0000000100000000] : region allocation successful
[0.070s][trace][gc,alloc,region] Mutator Alloc Region: 1 31:(E)[0x00000000ffe00000,0x00000000ffe7ae20,0x0000000100000000] : alloc locked (second attempt) min 62916 desired 62916 actual 62916 0x00000000ffe00000
[0,251s][trace][gc,alloc,region] Mutator Alloc Region: 1 31:(E)[0x00000000ffe00000,0x00000000ffef5c98,0x0000000100000000] : alloc min 256 desired 62927 actual 62927 0x00000000ffe7ae20
java version "12-internal" 2019-03-19
Java(TM) SE Runtime Environment (slowdebug build 12-internal+0-2018-11-22-0909362.sjohanss...)
Java HotSpot(TM) 64-Bit Server VM (slowdebug build 12-internal+0-2018-11-22-0909362.sjohanss..., mixed mode, sharing)
[0,315s][trace][gc,alloc,region] Mutator Alloc Region: 1 31:(E)[0x00000000ffe00000,0x00000000fff70c20,0x0000000100000000] : alloc min 256 desired 62961 actual 62961 0x00000000ffef5c98
Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
21-01-2020

ILW = MML = P4
21-01-2020

The issues is reported with the use of a default CDS archive. The default CDS archive is created with 128M java heap. With 64M runtime java heap, the archive heap regions are within the runtime heap range. However, since the runtime use 2M alignment (-XX:G1HeapRegionSize=2m) for GC region, FileMapInfo::map_heap_regions_impl relocates the computed relocated_closed_heap_region_bottom 1M lower in order to obtain 2M alignment. That causes the archive heap region to be mapped to a lower region, instead of the highest free region.
24-11-2018