NonMoving: Don't do major GC if one is already running
authorBen Gamari <ben@smart-cactus.org>
Fri, 17 May 2019 23:18:42 +0000 (19:18 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 21 May 2019 13:39:37 +0000 (09:39 -0400)
commitfb3714848721b0e1193ea4cf2a4dbea1a2f075c5
treecfb30d529f3817b0d2f2544136f6aaad56417f6e
parent681d65d4f44bc20cd530806ac468837d2268cc8b
NonMoving: Don't do major GC if one is already running

Previously we would perform a preparatory moving collection, resulting
in many things being added to the mark queue. When we finished with this
we would realize in nonmovingCollect that there was already a collection
running, in which case we would simply not run the nonmoving collector.

However, it was very easy to end up in a "treadmilling" situation: all
subsequent GC following the first failed major GC would be scheduled as
major GCs. Consequently we would continuously feed the concurrent
collector with more mark queue entries and it would never finish.

This patch aborts the major collection far earlier, meaning that we
avoid adding nonmoving objects to the mark queue and allowing the
concurrent collector to finish.
rts/sm/GC.c