rts/BlockAlloc: Use allocLargeChunk in aligned block allocation
authorBen Gamari <ben@smart-cactus.org>
Mon, 4 Mar 2019 22:20:39 +0000 (17:20 -0500)
committerBen Gamari <ben@smart-cactus.org>
Wed, 19 Jun 2019 00:30:20 +0000 (20:30 -0400)
rts/sm/BlockAlloc.c

index 84892a4..b07a8c6 100644 (file)
@@ -511,7 +511,10 @@ allocAlignedGroupOnNode (uint32_t node, W_ n)
     uint32_t num_blocks = 2*n - 1;
     W_ group_size = n * BLOCK_SIZE;
 
-    bdescr *bd = allocGroupOnNode(node, num_blocks);
+    // It's okay if we get a group larger than what we request; we will end up
+    // splitting it anyways. By using allocLargeChunk we reduce the potential
+    // for fragmentation.
+    bdescr *bd = allocLargeChunkOnNode(node, num_blocks, 3*n);
 
     // slop on the low side
     W_ slop_low = 0;