diff options
author | Rickard Green <[email protected]> | 2016-03-29 14:54:10 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-03-29 14:54:10 +0200 |
commit | 60479cec6169d3d3495f5e8e6cadee30d22a4d60 (patch) | |
tree | 23cd056c9c707dc2705a9d495040ae3ab3d558cd /erts | |
parent | c921c91178c6626381ddd64249ec1ce670de2595 (diff) | |
parent | 3c2d5d0dccd34cba89880cd4c1ded616d19696c2 (diff) | |
download | otp-60479cec6169d3d3495f5e8e6cadee30d22a4d60.tar.gz otp-60479cec6169d3d3495f5e8e6cadee30d22a4d60.tar.bz2 otp-60479cec6169d3d3495f5e8e6cadee30d22a4d60.zip |
Merge branch 'rickard/delayed-gc-fix'
* rickard/delayed-gc-fix:
Allow delayed gc while scheduled out
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index d2185c4fbc..63a610e4aa 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -9333,8 +9333,6 @@ Process *schedule(Process *p, int calls) } else { sched_out_proc: - ASSERT(!(p->flags & F_DELAY_GC)); - #ifdef ERTS_SMP ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(p); esdp = p->scheduler_data; @@ -9895,15 +9893,24 @@ Process *schedule(Process *p, int calls) #endif if (state & ERTS_PSFLG_RUNNING_SYS) { - reds -= execute_sys_tasks(p, &state, reds); - if (reds <= 0 + /* + * GC is normally never delayed when a process + * is scheduled out, but might be when executing + * hand written beam assembly in + * prim_eval:'receive'. If GC is delayed we are + * not allowed to execute system tasks. + */ + if (!(p->flags & F_DELAY_GC)) { + reds -= execute_sys_tasks(p, &state, reds); + if (reds <= 0 #ifdef ERTS_DIRTY_SCHEDULERS - || ERTS_SCHEDULER_IS_DIRTY(esdp) - || (state & ERTS_PSFLGS_DIRTY_WORK) + || ERTS_SCHEDULER_IS_DIRTY(esdp) + || (state & ERTS_PSFLGS_DIRTY_WORK) #endif - ) { - p->fcalls = reds; - goto sched_out_proc; + ) { + p->fcalls = reds; + goto sched_out_proc; + } } ASSERT(state & ERTS_PSFLG_RUNNING_SYS); @@ -9933,7 +9940,7 @@ Process *schedule(Process *p, int calls) } if (ERTS_IS_GC_DESIRED(p)) { - if (!(state & ERTS_PSFLG_EXITING) && !(p->flags & F_DISABLE_GC)) { + if (!(state & ERTS_PSFLG_EXITING) && !(p->flags & (F_DELAY_GC|F_DISABLE_GC))) { reds -= erts_garbage_collect_nobump(p, 0, p->arg_reg, p->arity); if (reds <= 0) { p->fcalls = reds; |