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

NMT: Re-examine virtual memory tracker shutdown sequence

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 18
    • hotspot

      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.





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

              Created:
              Updated:
              Resolved: