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

Use madvise MADV_HUGEPAGE only in THP madvise mode

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 22
    • hotspot

      When committing memory, if we use THPs, we madvise the kernel about THP usage.

      See os::pd_realign_memory():

      ```
        if (UseTransparentHugePages && alignment_hint > vm_page_size()) {
          // We don't check the return value: madvise(MADV_HUGEPAGE) may not
          // be supported or the memory may already be backed by huge pages.
          ::madvise(addr, bytes, MADV_HUGEPAGE);
        }
      ```

      That madvise call is unnecessary if on the system side we are in THP "always" mode, since khugepaged will form THPs regardless of what we advise him to do, so that is an unnecessary system call and can be avoided.

            stuefe Thomas Stuefe
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: