From 3ca75c7e42ab2c0612ceb5e56f60e7932c40f335 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 20 Oct 2014 16:04:44 +0200 Subject: erts: Fix bug causing mbc to be deleted from cpool before it was inserted Set IN_POOL flag _after_ mbc has been actually inserted. Earlier it did not matter if IN_POOL was set early as it was not possible to find a carrier before is was fully inserted. Now when searching pooled_list and traitor_list we must make sure a found carrier has been fully inserted into cpool before removing it. --- erts/emulator/beam/erl_alloc_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'erts/emulator/beam/erl_alloc_util.c') diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c index 0ea9b62103..e3172dc4fb 100644 --- a/erts/emulator/beam/erl_alloc_util.c +++ b/erts/emulator/beam/erl_alloc_util.c @@ -2835,9 +2835,6 @@ cpool_insert(Allctr_t *allctr, Carrier_t *crr) (erts_aint_t) CARRIER_SZ(crr)); erts_atomic_inc_nob(&allctr->cpool.stat.no_carriers); - erts_smp_atomic_set_nob(&crr->allctr, - ((erts_aint_t) allctr)|ERTS_CRR_ALCTR_FLG_IN_POOL); - /* * We search in 'next' direction and begin by passing * one element before trying to insert. This in order to @@ -2896,6 +2893,9 @@ cpool_insert(Allctr_t *allctr, Carrier_t *crr) cpool_set_mod_marked(&cpd2p->prev, (erts_aint_t) &crr->cpool, (erts_aint_t) cpd1p); + + erts_smp_atomic_set_wb(&crr->allctr, + ((erts_aint_t) allctr)|ERTS_CRR_ALCTR_FLG_IN_POOL); } static void -- cgit v1.2.3