aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_gc.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-12-14 15:40:45 +0100
committerBjörn-Egil Dahlberg <[email protected]>2012-12-14 15:40:45 +0100
commit29f9a9ca800e136588861b666fd9ae03214b2c9c (patch)
tree65d6aac4c006bfe6ca1d2d8a5748820164c8d3d3 /erts/emulator/beam/erl_gc.c
parent70892a1e03e441b24f879a9bb5f124defbab2e16 (diff)
parent4795e4510804f5c1a0160443b9a7b56caa9d369e (diff)
downloadotp-29f9a9ca800e136588861b666fd9ae03214b2c9c.tar.gz
otp-29f9a9ca800e136588861b666fd9ae03214b2c9c.tar.bz2
otp-29f9a9ca800e136588861b666fd9ae03214b2c9c.zip
Merge branch 'sverk/egil/r16/new-alloc-header-scheme/OTP-10273'
OTP-10415 * sverk/egil/r16/new-alloc-header-scheme/OTP-10273: (42 commits) erts: Make ll main mbc fit into 2pow size erts: Clear entire mseg cache upon request erts: Reduce max heap sizes tests: Refactor away ?line macro in beam_SUITE tests: Fix heap_sizes check tests: Refactor away ?line macro in process_SUITE tests: Use new correct min_bin_vheap_size in test erts: Set super alignment (256kb) and limits for sbct (8Mb) and lmbcs (128Mb) erts: Do not cache segments that are misaligned erts: Add mseg cache for large sbc segments erts: Reintroduce mseg options amcbf and rmcbf erts: Optimize erl_alloc_util.c by substitute MBC_BLK_SZ erts: Fix bug when allocating size near sbc_threshold erts: Make gc sizes fit into MB Carrier blocks erts: Force sbmbc to be disabled in a crude way erts: Fix new header scheme for win64 erts: Fix mseg cache. Malplaced NULL pointer erts: Remove unused mseg options amcbf and rmcbf erts: Use aligned bits as constant in mseg_alloc erts: Don't let zero be considered a power of two ... Conflicts: erts/emulator/test/process_SUITE.erl
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r--erts/emulator/beam/erl_gc.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index d377ba8f31..a33085315a 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -129,7 +129,7 @@ static void disallow_heap_frag_ref(Process* p, Eterm* n_htop, Eterm* objv, int n
#if defined(ARCH_64) && !HALFWORD_HEAP
# define MAX_HEAP_SIZES 154
#else
-# define MAX_HEAP_SIZES 55
+# define MAX_HEAP_SIZES 59
#endif
static Sint heap_sizes[MAX_HEAP_SIZES]; /* Suitable heap sizes. */
@@ -144,6 +144,7 @@ void
erts_init_gc(void)
{
int i = 0;
+ Sint max_heap_size = 0;
ASSERT(offsetof(ProcBin,thing_word) == offsetof(struct erl_off_heap_header,thing_word));
ASSERT(offsetof(ProcBin,thing_word) == offsetof(ErlFunThing,thing_word));
@@ -168,16 +169,30 @@ erts_init_gc(void)
* we really don't want that growth when the heaps are that big.
*/
- heap_sizes[0] = 34;
- heap_sizes[1] = 55;
- for (i = 2; i < 23; i++) {
- heap_sizes[i] = heap_sizes[i-1] + heap_sizes[i-2];
+ /* Growth stage 1 - Fibonacci + 1*/
+ /* 12,38 will hit size 233, the old default */
+
+ heap_sizes[0] = 12;
+ heap_sizes[1] = 38;
+
+ for(i = 2; i < 23; i++) {
+ /* one extra word for block header */
+ heap_sizes[i] = heap_sizes[i-1] + heap_sizes[i-2] + 1;
}
+
+ /* for 32 bit we want max_heap_size to be MAX(32bit) / 4 [words] (and halfword)
+ * for 64 bit we want max_heap_size to be MAX(52bit) / 8 [words]
+ */
+
+ max_heap_size = sizeof(Eterm) < 8 ? (Sint)((~(Uint)0)/(sizeof(Eterm))) :
+ (Sint)(((Uint64)1 << 53)/sizeof(Eterm));
+
+ /* Growth stage 2 - 20% growth */
/* At 1.3 mega words heap, we start to slow down. */
for (i = 23; i < ALENGTH(heap_sizes); i++) {
- heap_sizes[i] = 5*(heap_sizes[i-1]/4);
- if (heap_sizes[i] < 0) {
+ heap_sizes[i] = heap_sizes[i-1] + heap_sizes[i-1]/5;
+ if ((heap_sizes[i] < 0) || heap_sizes[i] > max_heap_size) {
/* Size turned negative. Discard this last size. */
i--;
break;
@@ -868,14 +883,12 @@ minor_collection(Process* p, int need, Eterm* objv, int nobj, Uint *recl)
}
}
- if (wanted < MIN_HEAP_SIZE(p)) {
- wanted = MIN_HEAP_SIZE(p);
- } else {
- wanted = next_heap_size(p, wanted, 0);
- }
+ wanted = wanted < MIN_HEAP_SIZE(p) ? MIN_HEAP_SIZE(p)
+ : next_heap_size(p, wanted, 0);
if (wanted < HEAP_SIZE(p)) {
shrink_new_heap(p, wanted, objv, nobj);
}
+
ASSERT(HEAP_SIZE(p) == next_heap_size(p, HEAP_SIZE(p), 0));
return 1; /* We are done. */
}
@@ -1434,11 +1447,10 @@ adjust_after_fullsweep(Process *p, Uint size_before, int need, Eterm *objv, int
I think this is better as fullsweep is used mainly on
small memory systems, but I could be wrong... */
wanted = 2 * need_after;
- if (wanted < p->min_heap_size) {
- sz = p->min_heap_size;
- } else {
- sz = next_heap_size(p, wanted, 0);
- }
+
+ sz = wanted < p->min_heap_size ? p->min_heap_size
+ : next_heap_size(p, wanted, 0);
+
if (sz < HEAP_SIZE(p)) {
shrink_new_heap(p, sz, objv, nobj);
}