From 9cf67430bff860d47c359df6b997c8bcd0985f4c Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 22 May 2018 14:43:30 +0200 Subject: erts: Let allocator pooled_tree also use Age Order if configured for the allocator. This was not implemented and pooled_tree always used address order first fit. The "problem" was as a carrier can be part of both the pooled tree (of its owner) and the allocation tree (of a foreign instance) at the same time. Solved by duplicating 'birth_time' in both AOFF_RBTree_t nodes for each carrier. Blocks still cannot use age order and does not pay any memory cost for birth_time. --- erts/emulator/beam/erl_alloc_util.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'erts/emulator/beam/erl_alloc_util.h') diff --git a/erts/emulator/beam/erl_alloc_util.h b/erts/emulator/beam/erl_alloc_util.h index ff4d10b206..cbae8ce98a 100644 --- a/erts/emulator/beam/erl_alloc_util.h +++ b/erts/emulator/beam/erl_alloc_util.h @@ -414,6 +414,10 @@ struct AOFF_RBTree_t_ { AOFF_RBTree_t *right; Uint32 flags; Uint32 max_sz; /* of all blocks in this sub-tree */ + union { + AOFF_RBTree_t* next; /* for best fit */ + Sint64 birth_time; /* for age first fit */ + } u; }; void aoff_add_pooled_mbc(Allctr_t*, Carrier_t*); -- cgit v1.2.3