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

[nmt] Remove the need for ThreadStackTracker::track_as_vm()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 23
    • hotspot
    • b24

      NMT has two ways to track thread stacks:
      - piggybacking on the virtual memory accounting
      - piggybacking on malloc accounting

      It does the former on all platforms except AIX. On AIX, it does the latter.

      The reason for this is that on AIX, thread stacks may not be page-aligned. So, on AIX, we track these stacks as if they were allocated with malloc. This adds a lot of complex coding to NMT.

      On Linux and Windows (notably not MacOS), we also query the liveness of the pages in the stack. So, we report (mislabeled as "committed," one of many confusing things about NMT) the actual live set size of thread stacks in the JVM.

      On AIX, however, we don't have a way to query liveness. Therefore, we report the full stack sizes as life.

      So, in the end, all the complex code that tracks thread stack regions piggybacking on the malloc accounting could just be replaced with a loop that adds up all thread stack sizes from all life threads.

      This problem can be solved in a much simpler way: when registering/unregistering thread stacks, we can just align the thread stack boundaries inward to the next innermost page boundaries. Now, AIX can use the same coding as the other platforms.

      As for the liveness query problem, this comes down to the `os::committed_in_range` API, which is only implemented on Windows and Linux. On MacOS (and with this proposal on AIX, too), the API is stubbed out and behaves as if the full range had been committed. (btw, again, wrong naming, it is not about being committed but about memory liveness).

      The result is the same: AIX reports that thread stacks are fully committed. However, it does so without needing special coding; it can just reuse the general solution all other platforms use.

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

              Created:
              Updated:
              Resolved: