summaryrefslogtreecommitdiff
path: root/includes/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-04-09 20:49:52 +0100
committerSimon Marlow <marlowsd@gmail.com>2016-04-12 03:14:06 -0700
commitf4446c5b963af8f3cc1693e2feab91dbe43d5237 (patch)
tree861d9bb9fea7086459bb734498348226e5d06019 /includes/rts
parent5c4cd0e44657d52f7ca5fee63f8765d17f1fbe85 (diff)
downloadhaskell-f4446c5b963af8f3cc1693e2feab91dbe43d5237.tar.gz
Allocate blocks in the GC in batches
Avoids contention for the block allocator lock in the GC; this can be seen in the gc_alloc_block_sync counter emitted by +RTS -s. I experimented with this a while ago, and there was already commented-out code for it in GCUtils.c, but I've now improved it so that it doesn't result in significantly worse memory usage. * The old method of putting spare blocks on ws->part_list was wasteful, the spare blocks are now shared between all generations and retained between GCs. * repeated allocGroup() results in fragmentation, so I switched to using allocLargeChunk() instead which is fragmentation-friendly; we already use it for the same reason in nursery allocation.
Diffstat (limited to 'includes/rts')
-rw-r--r--includes/rts/storage/Block.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h
index 755c8177cf..024f78c6e3 100644
--- a/includes/rts/storage/Block.h
+++ b/includes/rts/storage/Block.h
@@ -89,7 +89,8 @@ typedef struct bdescr_ {
StgPtr start; // [READ ONLY] start addr of memory
- StgPtr free; // first free byte of memory.
+ StgPtr free; // First free byte of memory.
+ // allocGroup() sets this to the value of start.
// NB. during use this value should lie
// between start and start + blocks *
// BLOCK_SIZE. Values outside this