Allocate mark queues in larger block groups
authorBen Gamari <ben@smart-cactus.org>
Sun, 14 Apr 2019 16:26:57 +0000 (12:26 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 19 Jun 2019 01:42:04 +0000 (21:42 -0400)
rts/sm/NonMovingMark.c
rts/sm/NonMovingMark.h

index bea7696..2d6da49 100644 (file)
@@ -361,7 +361,7 @@ push (MarkQueue *q, const MarkQueueEnt *ent)
         } else {
             // allocate a fresh block.
             ACQUIRE_SM_LOCK;
-            bdescr *bd = allocGroup(1);
+            bdescr *bd = allocGroup(MARK_QUEUE_BLOCKS);
             bd->link = q->blocks;
             q->blocks = bd;
             q->top = (MarkQueueBlock *) bd->start;
@@ -742,7 +742,7 @@ again:
 /* Must hold sm_mutex. */
 static void init_mark_queue_ (MarkQueue *queue)
 {
-    bdescr *bd = allocGroup(1);
+    bdescr *bd = allocGroup(MARK_QUEUE_BLOCKS);
     queue->blocks = bd;
     queue->top = (MarkQueueBlock *) bd->start;
     queue->top->head = 0;
index b9ceaea..45669ba 100644 (file)
@@ -93,8 +93,11 @@ typedef struct {
     MarkQueue queue;
 } UpdRemSet;
 
+// Number of blocks to allocate for a mark queue
+#define MARK_QUEUE_BLOCKS 16
+
 // The length of MarkQueueBlock.entries
-#define MARK_QUEUE_BLOCK_ENTRIES ((BLOCK_SIZE - sizeof(MarkQueueBlock)) / sizeof(MarkQueueEnt))
+#define MARK_QUEUE_BLOCK_ENTRIES ((MARK_QUEUE_BLOCKS * BLOCK_SIZE - sizeof(MarkQueueBlock)) / sizeof(MarkQueueEnt))
 
 extern bdescr *nonmoving_large_objects, *nonmoving_marked_large_objects;
 extern memcount n_nonmoving_large_blocks, n_nonmoving_marked_large_blocks;