aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-05-25 12:22:05 +0200
committerLukas Larsson <[email protected]>2018-05-25 12:22:05 +0200
commit4ac9aa587aa0091162e2520fbf9285ade6e8b74e (patch)
tree03b18dc9fd018c12a9802403b7263de9de00bcc9
parent39328ee50d04bd7abfe835f295d92edd17701d64 (diff)
downloadotp-4ac9aa587aa0091162e2520fbf9285ade6e8b74e.tar.gz
otp-4ac9aa587aa0091162e2520fbf9285ade6e8b74e.tar.bz2
otp-4ac9aa587aa0091162e2520fbf9285ade6e8b74e.zip
erts: Make sure scheduler_data is set
If scheduler_data is not set correctly on normal schedulers the code in erts_schedule_time_break and possibly others will trigger asserts.
-rw-r--r--erts/emulator/beam/erl_process.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 1478b71195..8253ec4f40 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -9186,6 +9186,7 @@ Process *erts_schedule(ErtsSchedulerData *esdp, Process *p, int calls)
internal_sched_out_proc:
ERTS_CHK_HAVE_ONLY_MAIN_PROC_LOCK(p);
+ ASSERT(p->scheduler_data || ERTS_SCHEDULER_IS_DIRTY(esdp));
ASSERT(actual_reds >= 0);
if (reds < ERTS_PROC_MIN_CONTEXT_SWITCH_REDS_COST)
@@ -9618,6 +9619,8 @@ Process *erts_schedule(ErtsSchedulerData *esdp, Process *p, int calls)
state = erts_atomic32_read_nob(&p->state);
if (is_normal_sched) {
+ ASSERT(!p->scheduler_data);
+ p->scheduler_data = esdp;
if ((!!(state & ERTS_PSFLGS_DIRTY_WORK))
& (!(state & ERTS_PSFLG_ACTIVE_SYS))) {
/* Migrate to dirty scheduler... */
@@ -9625,8 +9628,6 @@ Process *erts_schedule(ErtsSchedulerData *esdp, Process *p, int calls)
erts_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
goto sched_out_proc;
}
- ASSERT(!p->scheduler_data);
- p->scheduler_data = esdp;
}
else {
if (!(state & ERTS_PSFLGS_DIRTY_WORK)) {