diff options
author | Sverker Eriksson <[email protected]> | 2016-06-20 18:32:47 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-06-20 20:30:17 +0200 |
commit | c50cceb0def3e0123e92cee41bd9b6dde8bf2a75 (patch) | |
tree | 1779ad97902a0e79fe255e3f50a6330c498b7f98 /erts/emulator/sys/unix | |
parent | 3f64be5c822e1ee4d1dc2a4289e4906d789c64ac (diff) | |
download | otp-c50cceb0def3e0123e92cee41bd9b6dde8bf2a75.tar.gz otp-c50cceb0def3e0123e92cee41bd9b6dde8bf2a75.tar.bz2 otp-c50cceb0def3e0123e92cee41bd9b6dde8bf2a75.zip |
erts: Optimize spawn driver for large(r) environments
that need to be enqueued.
Diffstat (limited to 'erts/emulator/sys/unix')
-rw-r--r-- | erts/emulator/sys/unix/sys_drivers.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/erts/emulator/sys/unix/sys_drivers.c b/erts/emulator/sys/unix/sys_drivers.c index 812112fb91..e08ef41817 100644 --- a/erts/emulator/sys/unix/sys_drivers.c +++ b/erts/emulator/sys/unix/sys_drivers.c @@ -765,9 +765,14 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, if (res < (buffsz + sizeof(buffsz))) { /* we only wrote part of the command payload. Enqueue the rest. */ for (i = 0; i < iov_len; i++) { - driver_enq(port_num, io_vector[i].iov_base, io_vector[i].iov_len); + if (res >= io_vector[i].iov_len) + res -= io_vector[i].iov_len; + else { + driver_enq(port_num, io_vector[i].iov_base + res, + io_vector[i].iov_len - res); + res = 0; + } } - driver_deq(port_num, res); driver_select(port_num, ofd[1], ERL_DRV_WRITE|ERL_DRV_USE, 1); } |