Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8244847

Linux/PPC: runtime/CompressedOops/CompressedClassPointers: smallHeapTest fails


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 12, 13, 14
    • Fix Version/s: 16
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
    • CPU:
    • OS:


      smallHeapTest fails on Linux/PPC, because the narrow klass base is not 0x0.

      ### Reproduce

      java -Xmx1g -Xshare:off -Xlog:metaspace*=info -version

      => Narrow klass base: 0x00007fff28000000 // Should be 0x0

      ### Preconditions

      CDS needs to be disabled.

      At most 2g maximum heap size.

      Linux kernel 4.12 or higher [6][7]
      Downported to 4.1.42 [8]

      ### Analysis (addresses modulo ASLR in the lower bits)

      JDK-8233410 made the java launcher a position independent executable (PIE). As a side effect the
      launcher gets loaded to 0x0000000100000000 (4g). Before it was loaded to 0x0000000010000000 (256m)
      [1]. With the precoditions above 4g is precisely the address where current heuristics do a one shot
      attempt to get a zero based compressed class space (CCS) which now always fails.

      On x86_64 the issue does not exist, because ELF_ET_DYN_BASE is well above 32g.

      More Details:

      The small java heap (-Xmx128m) is mapped just below 4g in
      ReservedHeapSpace::initialize_compressed_heap() which calls try_reserve_range() with highest_start
      == UnscaledOopHeapMax == 4g and lowest_start == HeapBaseMinAddress == 2g [2]. try_reserve_range()
      searches from top to bottom [3], and is successfull at first try. So the heap is mapped just below

      Metaspace::global_initialize() requests to map the CCS right after the java heap [4]. This fails,
      because the launcher is already mapped to 4g (see above).
      Metaspace::reserve_address_space_for_compressed_classes() is called to handle the failure. On PPC this method does not try to get a zerobased CCS [5].

      [1] ELF_ET_DYN_BASE for PPC

      [2] ReservedHeapSpace::initialize_compressed_heap(): call to try_reserve_range(highest=4g, lowest=2g)

      [3] ReservedHeapSpace::try_reserve_range(): search from top to bottom

      [4] Metaspace::global_initialize(): try to map CCS just after java heap

      [5] Metaspace::reserve_address_space_for_compressed_classes() does not try to get a good address for CCS on PPC

      [6] Linux kernel commit that changed ELF_ET_DYN_BASE from 0x20000000 to 0x100000000UL on PPC

      [7] ELF_ET_DYN_BASE was changed [6] with Linux version 4.12

      [8] Downport of ELF_ET_DYN_BASE change to 4.1.42


          Issue Links



              • Assignee:
                rrich Richard Reingruber
                rrich Richard Reingruber
              • Votes:
                0 Vote for this issue
                5 Start watching this issue


                • Created: