From 9ef6b9a923b25ceb487eea4431cdf730972fc489 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Wed, 7 Mar 2018 16:18:24 +0100 Subject: Fix for bug introduced when replacing ERTS_PSFLG_BOUND Bug introduced in commit fbb10ebc4a37555c7ea7f99e14286d862993976a --- erts/emulator/beam/erl_process.c | 17 +++++++++-------- erts/emulator/beam/erl_process.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index b19659f496..23fe353495 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -4135,8 +4135,6 @@ evacuate_run_queue(ErtsRunQueue *rq, for (prio_q = 0; prio_q < ERTS_NO_PROC_PRIO_QUEUES; prio_q++) { erts_aint32_t state; Process *proc; - int notify = 0; - to_rq = NULL; if (!mp->prio[prio_q].runq) return; @@ -4195,6 +4193,12 @@ evacuate_run_queue(ErtsRunQueue *rq, goto handle_next_proc; } + prio = (int) ERTS_PSFLGS_GET_PRQ_PRIO(state); + to_rq = mp->prio[prio].runq; + + if (!to_rq) + goto handle_next_proc; + if (!erts_try_change_runq_proc(proc, to_rq)) { /* Bound processes get stuck here... */ proc->next = NULL; @@ -4205,15 +4209,13 @@ evacuate_run_queue(ErtsRunQueue *rq, sbpp->last = proc; } else { - int prio = (int) ERTS_PSFLGS_GET_PRQ_PRIO(state); erts_runq_unlock(rq); - to_rq = mp->prio[prio].runq; - erts_runq_lock(to_rq); enqueue_process(to_rq, prio, proc); erts_runq_unlock(to_rq); - notify = 1; + + smp_notify_inc_runq(to_rq); erts_runq_lock(rq); } @@ -4221,8 +4223,7 @@ evacuate_run_queue(ErtsRunQueue *rq, handle_next_proc: proc = dequeue_process(rq, prio_q, &state); } - if (notify) - smp_notify_inc_runq(to_rq); + } } diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h index e585fabb51..8581c6a639 100644 --- a/erts/emulator/beam/erl_process.h +++ b/erts/emulator/beam/erl_process.h @@ -2292,6 +2292,7 @@ erts_set_runq_proc(Process *p, ErtsRunQueue *rq, int *bndp) { erts_aint_t rqint = (erts_aint_t) rq; ASSERT(bndp); + ASSERT(rq); if (*bndp) rqint |= ERTS_RUNQ_BOUND_FLAG; rqint = erts_atomic_xchg_nob(&p->run_queue, rqint); -- cgit v1.2.3