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

os::large_page_init() turns off THPs for ZGC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 22
    • 22
    • hotspot
    • gc
    • b27

      There is code in os::large_page_init() that checks /sys/kernel/mm/transparent_hugepage/enabled and forcefully turns off UseTransparentHugePages if anonymous THPs are disabled in the OS:

        if (UseTransparentHugePages && !HugePages::supports_thp()) {
          if (!FLAG_IS_DEFAULT(UseTransparentHugePages)) {
            log_warning(pagesize)("UseTransparentHugePages disabled, transparent huge pages are not supported by the operating system.");
          }
          UseLargePages = UseTransparentHugePages = false;
          return;
        }

      This is problematic because ZGC doesn't use the /sys/kernel/mm/transparent_hugepage/enabled THPs, but instead the /sys/kernel/mm/transparent_hugepage/shmem_enabled THPs. So, with the following settings:
      /sys/kernel/mm/transparent_hugepage/enabled: never
      /sys/kernel/mm/transparent_hugepage/shmem_enabled: advise

      the above code will force ZGC to run without THPs.

            stefank Stefan Karlsson
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: