[sgen] Avoid using parallel minors for small nurseries
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 9 Jun 2017 22:50:20 +0000 (01:50 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Fri, 9 Jun 2017 22:50:20 +0000 (01:50 +0300)
It is not effective and it can lead to regressions, due to the added synchronizations and work splitting.

mono/sgen/sgen-conf.h
mono/sgen/sgen-gc.c

index 63e922c470e0745f5e16340a858be806b08deb2b..f6738e4d6eb9d34232ecfb23c729eb97266808cf 100644 (file)
@@ -219,4 +219,10 @@ typedef mword SgenDescriptor;
 #define SGEN_MAX_PAUSE_TIME 30
 #define SGEN_MAX_PAUSE_MARGIN 0.66f
 
+/*
+ * In practice, for nurseries smaller than this, the parallel minor tends to be
+ * ineffective, even leading to regressions. Avoid using it for smaller nurseries.
+ */
+#define SGEN_PARALLEL_MINOR_MIN_NURSERY_SIZE (1 << 24)
+
 #endif
index 03dfc5cfddd49c9ea8021b4439ec785992753ca2..5213dda70ee2f457e478af3d58cc3862abec292c 100644 (file)
@@ -1641,7 +1641,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
                object_ops_nopar = &sgen_minor_collector.serial_ops_with_concurrent_major;
        } else {
                object_ops_nopar = &sgen_minor_collector.serial_ops;
-               if (sgen_minor_collector.is_parallel) {
+               if (sgen_minor_collector.is_parallel && sgen_nursery_size >= SGEN_PARALLEL_MINOR_MIN_NURSERY_SIZE) {
                        object_ops_par = &sgen_minor_collector.parallel_ops;
                        is_parallel = TRUE;
                }