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

[Linux] Java guard page VMAs should clear the VM_ACCOUNT mm flag

    XMLWordPrintable

Details

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

    Description

      Observed with Ubuntu 20.04 (kernel 5.15, glibc 2.31):

      Our guard pages (created with mprotect PROT_NONE) still count as "accountable" VMAs. The glibc's guard pages do not, even though they are also created with mprotect PROT_NONE. See smaps:

      GLIBC guard page:

      ```
      7ff15f582000-7ff15f583000 ---p 00000000 00:00 0
      Size: 4 kB
      KernelPageSize: 4 kB
      MMUPageSize: 4 kB
      Rss: 0 kB
      ...
      VmFlags: mr mw me sd
      ```

      Our guard pages:

      ```
      7ff15f583000-7ff15f587000 ---p 00000000 00:00 0
      Size: 16 kB
      KernelPageSize: 4 kB
      MMUPageSize: 4 kB
      Rss: 0 kB
      Pss: 0 kB
      ...
      VmFlags: mr mw me ac sd <<<< AC is set
      ```

      This has two negative effects:

      1) our guard pages still count toward the OOM killer

      2) in situations where both glibc guard page and Java guard pages are active, the two VMAs cannot be merged into one; that means that we pay, for each thread, with 3 VMAs (thread stack, our guard page, glibc guard page). This may cause us to exhaust the maximum number of allowed mappings earlier.

      (2) is an issue when THPs are enabled and we therefore enable glibc guard pages atop of JVM guard pages to prevent formation of inter-thread-stack VMAs (see JDK-8312182).


      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: