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

Respect the -Xmx setting rather than adjusting it to the card table size

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc

      Description

      The size of the card table is aligned to the smallest OS page size. Each byte in the card table corresponds to 512 bytes of Java heap. That means that with a page size of 4K, one page in the card table will cover 2m of Java heap.

      This has lead to the limitation that we align the heap size based on the card table size. Meaning that we will always have a heap size aligned by 2m.

      if the smallest OS page size is larger we get larger alignment. On Sparc the smallest page size is 8K, which means that the Java heap is 4m aligned.

      This causes some, IMHO, unexpected behavior:

      $ java -Xmx2m -XX:-UseLargePages -XX:+PrintFlagsFinal -version | grep MaxHeapSize
          uintx MaxHeapSize := 4194304 {product}

      I specify 2m heap size on the command line but get 4m.

      According to the documentation for -Xmx it should support 2m sizes:
      https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html

      It is probably a good idea to have the card table be page aligned. But that does not mean that we have to utilize all of it. We could have a card table that could potentially cover 4m heap but still only use a 2m heap.

      Once this is fixed we should add a test that verifies that it is possible to start the VM with a 2m heap size on all platforms. And that you actually get 2m heap and not more.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                brutisso Bengt Rutisson (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: