JDK-7143858 attempted to eliminate unnecessary gc-locker collections that sometimes immediately followed another young collection. Although this problem was only reported against G1, and the fix is G1-specific, it was later (
JDK-8048556) found to be a problem for several other collectors too.
JDK-8048556 also showed that the
JDK-7143858 change was insufficient, and unnecessary gc-locker collections could still occur, due to a race with the GCLocker's active state handling.
JDK-7143858 made threads failing allocation stall when the GCLocker indicates a GC is needed, forcing them to wait until the gc-locker collection has been done. It would be better to only stall when the GCLocker is active and a GC is needed, as is done by other collectors. This allows a thread failing allocation to proceed to the GC without waiting for the no-longer-active GCLocker's collection attempt, with the quickest doing the honors.