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

CMS+ParNew: fix potential incorrect uses of save_marks() and oop_iterate_since_save_marks()


    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 7
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Introduced In Build:
    • Introduced In Version:
    • CPU:
    • OS:


      Amongst the changes in 7039089 was a newly added assert that checks that
      when a thread issues a younger_refs_iterate() call, the observed used_region()
      is a superset of use_region_at_save_marks(). The intention of the assertion
      was to ensure that a save_marks() call had been done by the GC coordinator
      thread (aka the VM thread) prior to the younger_refs_iterate() call.
      The save_marks() mechanism itself may be considered a vestige of the
      single-threaded Cheney scan scheme where one could keep track of grey
      objects as they were copied into a contiguous space without the
      need for an explicit stack. Given the use of promotion LABs and such
      in the parallel collectors, save_marks() is really obsolete for its
      original purpose of avoiding stacks to keep track of grey objects.
      Rather its sole use in parallel collector code is to record, in the
      case of contiguous or pseduo-contiguous spaces, the highest address
      to which it is reasonable to look for refs (in other words to avoid
      looking at newly promoted objects in the case of contiguous spaces).

      In any case, it is reasonable to expect that parallel worker threads
      should always find that the used_region() is a strict superset of
      used_region_at_save_marks(), with (in the case of parallel collectors)
      the latter being a constant during any single collection.

      It appears as though that is not the case with ParNew+CMS, and we
      need to fix the code so the invariant holds, otherwise there is
      some chance that a flickering used_region_at_save_marks() could
      miss refs that needed to be looked at or attempt to access
      cards that do not have objects on them. The former would be
      a more insidious problem than the latter, of course.

      If investigation reveals that this is a more serious problem,
      we may revise the target and priority of this CR.

      Since the issue appears to be a long-standing one that just happened
      to be exposed on account of the newly-added assert, we have set this
      at priority P4 and targeted it to post-7 given the late stage of
      JDK 7 development and the presence of potentially bigger fish (or bugs)
      to fry (or respectively catch) at the moment.




            • Assignee:
              ysr Y. Ramakrishna
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: