aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc_util.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2012-04-27 13:06:27 +0200
committerRickard Green <[email protected]>2012-04-27 13:06:27 +0200
commit398bb9a9a5b2a56f0333ce81efe00380692ec93a (patch)
treeadb7239744ae6f3d45f672e29d9c2bd97e0e67d9 /erts/emulator/beam/erl_alloc_util.c
parent52312a8b93e8b250099e2f1b1b802e63e37971cc (diff)
parent3730e28ad736f0538141d4474e0038a9cc48df71 (diff)
downloadotp-398bb9a9a5b2a56f0333ce81efe00380692ec93a.tar.gz
otp-398bb9a9a5b2a56f0333ce81efe00380692ec93a.tar.bz2
otp-398bb9a9a5b2a56f0333ce81efe00380692ec93a.zip
Merge branch 'rickard/proc-sched/OTP-9892'
* rickard/proc-sched/OTP-9892: Teach etp-commands to understand new emulator internal data structures Optimize process state changes Optimize process table access Implement possibility to use ordinary mutexes as process locks Conflicts: erts/emulator/beam/erl_alloc.types
Diffstat (limited to 'erts/emulator/beam/erl_alloc_util.c')
-rw-r--r--erts/emulator/beam/erl_alloc_util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c
index e0d525bdde..62225d3572 100644
--- a/erts/emulator/beam/erl_alloc_util.c
+++ b/erts/emulator/beam/erl_alloc_util.c
@@ -832,14 +832,14 @@ init_dd_queue(ErtsAllctrDDQueue_t *ddq)
static ERTS_INLINE erts_aint_t
ddq_managed_thread_enqueue(ErtsAllctrDDQueue_t *ddq, void *ptr)
{
- erts_aint_t ilast, itmp;
+ erts_aint_t first_ilast, ilast, itmp;
ErtsAllctrDDBlock_t *this = ptr;
erts_atomic_init_nob(&this->atmc_next, ERTS_AINT_NULL);
/* Enqueue at end of list... */
- ilast = erts_atomic_read_nob(&ddq->tail.data.last);
+ first_ilast = ilast = erts_atomic_read_nob(&ddq->tail.data.last);
while (1) {
ErtsAllctrDDBlock_t *last = (ErtsAllctrDDBlock_t *) ilast;
itmp = erts_atomic_cmpxchg_mb(&last->atmc_next,
@@ -853,8 +853,11 @@ ddq_managed_thread_enqueue(ErtsAllctrDDQueue_t *ddq, void *ptr)
/* Move last pointer forward... */
while (1) {
if (erts_atomic_read_rb(&this->atmc_next) != ERTS_AINT_NULL) {
- /* Someone else will move it forward */
- return erts_atomic_read_rb(&ddq->tail.data.last);
+ ilast = erts_atomic_read_rb(&ddq->tail.data.last);
+ if (first_ilast != ilast) {
+ /* Someone else will move it forward */
+ return ilast;
+ }
}
itmp = erts_atomic_cmpxchg_mb(&ddq->tail.data.last,
(erts_aint_t) this,