summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/sm/GC.c12
-rw-r--r--rts/sm/NonMoving.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index a97042c718..6be81e5ff0 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -268,6 +268,18 @@ GarbageCollect (uint32_t collect_gen,
/* See Note [Deadlock detection under nonmoving collector]. */
deadlock_detect_gc = deadlock_detect;
+#if defined(THREADED_RTS)
+ if (major_gc && RtsFlags.GcFlags.useNonmoving && concurrent_coll_running) {
+ /* If there is already a concurrent major collection running then
+ * there is no benefit to starting another.
+ * TODO: Catch heap-size runaway.
+ */
+ N--;
+ collect_gen--;
+ major_gc = false;
+ }
+#endif
+
/* N.B. The nonmoving collector works a bit differently. See
* Note [Static objects under the nonmoving collector].
*/
diff --git a/rts/sm/NonMoving.h b/rts/sm/NonMoving.h
index 06894e98be..17adfd6666 100644
--- a/rts/sm/NonMoving.h
+++ b/rts/sm/NonMoving.h
@@ -93,6 +93,10 @@ extern struct NonmovingHeap nonmovingHeap;
extern memcount nonmoving_live_words;
+#if defined(THREADED_RTS)
+extern bool concurrent_coll_running;
+#endif
+
void nonmovingInit(void);
void nonmovingStop(void);
void nonmovingExit(void);