aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-01-08 11:45:33 +0100
committerJohn Högberg <[email protected]>2018-01-08 12:38:28 +0100
commit2e601a2efc19d64ed0628a5973596e6331ddcc7c (patch)
tree69fd042b12888225e9770e479f12231e883333fa /erts/emulator/beam/bif.c
parent68a0f569410f7375c44a9d806930b1172c1d92a8 (diff)
downloadotp-2e601a2efc19d64ed0628a5973596e6331ddcc7c.tar.gz
otp-2e601a2efc19d64ed0628a5973596e6331ddcc7c.tar.bz2
otp-2e601a2efc19d64ed0628a5973596e6331ddcc7c.zip
Remove sender punishment
The reduction cost of sending messages is now constant and will no longer scale according to the length of the receiving process' message queue.
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 0e5f7bb22b..f086c434ea 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -2244,20 +2244,15 @@ do_send(Process *p, Eterm to, Eterm msg, Eterm *refp, ErtsSendContext *ctx)
send_message: {
ErtsProcLocks rp_locks = 0;
- Sint res;
if (p == rp)
rp_locks |= ERTS_PROC_LOCK_MAIN;
/* send to local process */
- res = erts_send_message(p, rp, &rp_locks, msg, 0);
- if (erts_use_sender_punish)
- res *= 4;
- else
- res = 0;
+ erts_send_message(p, rp, &rp_locks, msg, 0);
erts_proc_unlock(rp,
p == rp
? (rp_locks & ~ERTS_PROC_LOCK_MAIN)
: rp_locks);
- return res;
+ return 0;
}
}
@@ -2312,8 +2307,8 @@ BIF_RETTYPE send_3(BIF_ALIST_3)
result = do_send(p, to, msg, &ref, ctx);
ERTS_MSACC_POP_STATE_M_X();
- if (result > 0) {
- ERTS_VBUMP_REDS(p, result);
+ if (result >= 0) {
+ ERTS_VBUMP_REDS(p, 4);
if (ERTS_IS_PROC_OUT_OF_REDS(p))
goto yield_return;
ERTS_BIF_PREP_RET(retval, am_ok);
@@ -2321,12 +2316,6 @@ BIF_RETTYPE send_3(BIF_ALIST_3)
}
switch (result) {
- case 0:
- /* May need to yield even though we do not bump reds here... */
- if (ERTS_IS_PROC_OUT_OF_REDS(p))
- goto yield_return;
- ERTS_BIF_PREP_RET(retval, am_ok);
- break;
case SEND_NOCONNECT:
if (ctx->connect) {
ERTS_BIF_PREP_RET(retval, am_ok);
@@ -2443,8 +2432,8 @@ Eterm erl_send(Process *p, Eterm to, Eterm msg)
ERTS_MSACC_POP_STATE_M_X();
- if (result > 0) {
- ERTS_VBUMP_REDS(p, result);
+ if (result >= 0) {
+ ERTS_VBUMP_REDS(p, 4);
if (ERTS_IS_PROC_OUT_OF_REDS(p))
goto yield_return;
ERTS_BIF_PREP_RET(retval, msg);
@@ -2452,12 +2441,6 @@ Eterm erl_send(Process *p, Eterm to, Eterm msg)
}
switch (result) {
- case 0:
- /* May need to yield even though we do not bump reds here... */
- if (ERTS_IS_PROC_OUT_OF_REDS(p))
- goto yield_return;
- ERTS_BIF_PREP_RET(retval, msg);
- break;
case SEND_NOCONNECT:
ERTS_BIF_PREP_RET(retval, msg);
break;