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

Make Metaspace ChunkManager counters non-atomic

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 9
    • 10
    • hotspot
    • None
    • b21

    Description

      In metaspace.cpp, ChunkManager keeps counters for the number of free chunks in all its free lists (_free_chunks_count) and combined size of all these chunks (_free_chunks_total). These counters are updated using Atomics.

      Supposedly because atomic updates are expensive, updates are delayed as much as possible. When returning chunks to the free list, instead of updating the counter for every returned chunk, the counter is updated for all chunks at once (~SpaceManager). This introduces time windows where the counters do not reflect the real state of the freelist, which makes it difficult to verify the internal state of the ChunkManager.

      The counters do not have to be updated atomically, because all accesses happen under lock protection. So the updates can be moved closer to the chunk return point and the window where counters are invalid almost disappears, making the code easier.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: