[sgen] Increase gray stack section size
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 28 Mar 2017 21:12:02 +0000 (00:12 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Tue, 4 Apr 2017 13:00:06 +0000 (16:00 +0300)
Stealing a gray section is relatively expensive since it requires locking. We want to avoid repeated stealing, since only one gray queue section is stolen at a time (in the case of the parallel collector).

mono/sgen/sgen-gray.h
mono/sgen/sgen-workers.c

index bbaefe07575539c21e9ba7f02708f8d5a8b1148a..3ea4037af245c7489790da11c2836eae471d4bd0 100644 (file)
@@ -47,7 +47,7 @@
 #define SGEN_GRAY_QUEUE_HEADER_SIZE    3
 #endif
 
-#define SGEN_GRAY_QUEUE_SECTION_SIZE   (128 - SGEN_GRAY_QUEUE_HEADER_SIZE)
+#define SGEN_GRAY_QUEUE_SECTION_SIZE   (512 - SGEN_GRAY_QUEUE_HEADER_SIZE)
 
 #ifdef SGEN_CHECK_GRAY_OBJECT_SECTIONS
 typedef enum {
index e1633f3f4ccf40010d25425427ea2784c6ae1c4e..d5343db50d1c37cb2f3241ebab4b9e0eb760823d 100644 (file)
@@ -61,6 +61,8 @@ enum {
        STATE_WORK_ENQUEUED
 };
 
+#define SGEN_WORKER_MIN_SECTIONS_SIGNAL 4
+
 typedef gint32 State;
 
 static SgenObjectOperations * volatile idle_func_object_ops;
@@ -330,7 +332,8 @@ marker_idle_func (void *data_untyped)
 
                sgen_drain_gray_stack (ctx);
 
-               if (data->private_gray_queue.num_sections > 16 && workers_finished && worker_awakenings < active_workers_num) {
+               if (data->private_gray_queue.num_sections >= SGEN_WORKER_MIN_SECTIONS_SIGNAL
+                               && workers_finished && worker_awakenings < active_workers_num) {
                        /* We bound the number of worker awakenings just to be sure */
                        worker_awakenings++;
                        mono_os_mutex_lock (&finished_lock);