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

NMT: Re-examine virtual memory tracker shutdown sequence

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 18
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      VirtualMemoryTracker takes ThreadCritical lock to check tracking level to ensure that it does not race again NMT shutdown.

      e.g. VirtualMemoryTracker::record_virtual_memory_split_reserved() has following comment:

          if (addr != NULL) {
            ThreadCritical tc;
            // Recheck to avoid potential racing during NMT shutdown
            if (tracking_level() < NMT_summary) return;
            VirtualMemoryTracker::split_reserved_region((address)addr, size, split);

      The comment seems incorrect, because NMT downgrades its tracking level without taking ThreadCritical lock, so reading tracking level is a race.

      However, it may not be a problem, because tracking level can only be downgraded monotonically, ThreadCritical lock is held and tracking level is already downgraded before downgrading transition.

      But this part of the code is obscure, we should re-examine and cleanup it up.





        Attachments

          Issue Links

            Activity

              People

              Assignee:
              zgu Zhengyu Gu
              Reporter:
              zgu Zhengyu Gu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: