aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-12-06 16:18:31 +0100
committerJohn Högberg <[email protected]>2017-12-06 19:30:59 +0100
commitd577018a76db8382421bcc6e7ed2dd2717867302 (patch)
tree247bd461ac55ebddd1aeb2dd2f8e90f4b6a8f522 /erts/emulator/beam/erl_nif.c
parentad484fc2003885e12b92ea49dcb1c71669761d62 (diff)
downloadotp-d577018a76db8382421bcc6e7ed2dd2717867302.tar.gz
otp-d577018a76db8382421bcc6e7ed2dd2717867302.tar.bz2
otp-d577018a76db8382421bcc6e7ed2dd2717867302.zip
"Fix" tracing of dirty NIFs on debug builds
When a dirty NIF is executed a "schedule in" trace event is generated, which may in turn result in a generic system task being created, causing the process to be scheduled out as it can't run dirty with pending tasks. This is usually fine since said system task is seldom created, but ERTS_FORCE_ENIF_SEND_DELAY was de-facto always on for debug builds, causing the process to bounce between dirty and normal schedulers forever. This commit is not a complete fix and it can go off the rails even on normal builds; if there's a lot of dirty jobs lined up and the receiver's msgq lock happens to be busy at the wrong time, the additional trace messages generated through this will hammer the lock and keep everything bouncing.
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index abb490cf9c..0a5fe026db 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -562,7 +562,7 @@ void enif_clear_env(ErlNifEnv* env)
#ifdef DEBUG
static int enif_send_delay = 0;
-#define ERTS_FORCE_ENIF_SEND_DELAY() (enif_send_delay++ % 2 == 0)
+#define ERTS_FORCE_ENIF_SEND_DELAY() (enif_send_delay++ % 32 == 0)
#else
#ifdef ERTS_PROC_LOCK_OWN_IMPL
#define ERTS_FORCE_ENIF_SEND_DELAY() 0