Skip to content

Commit 8c53715

Browse files
committed
Apply a patch to boehmgc to increase the initial mark stack size
If the mark stack size is too small, it greatly inhibits parallel marking, which is very bad for performance on multi-core systems.
1 parent f0763d5 commit 8c53715

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

packaging/dependencies.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ scope: {
5050
requiredSystemFeatures = [ ];
5151
};
5252

53-
boehmgc = pkgs.boehmgc.override {
54-
enableLargeConfig = true;
55-
};
53+
boehmgc =
54+
(pkgs.boehmgc.override {
55+
enableLargeConfig = true;
56+
}).overrideAttrs
57+
(attrs: {
58+
patches = attrs.patches or [ ] ++ [ ./patches/bdwgc-bigger-mark-stack.patch ];
59+
});
5660

5761
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
5862
boost =
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Increase the initial mark stack size to avoid stack overflows, since
2+
these inhibit parallel marking (see GC_mark_some()).
3+
4+
diff --git a/mark.c b/mark.c
5+
index 50e6cfd7..907f7763 100644
6+
--- a/mark.c
7+
+++ b/mark.c
8+
@@ -66,7 +66,7 @@ GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
9+
};
10+
11+
# ifndef INITIAL_MARK_STACK_SIZE
12+
-# define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE)
13+
+# define INITIAL_MARK_STACK_SIZE (256*HBLKSIZE)
14+
/* INITIAL_MARK_STACK_SIZE * sizeof(mse) should be a */
15+
/* multiple of HBLKSIZE. */
16+
/* The incremental collector actually likes a larger */

0 commit comments

Comments
 (0)