From c50cceb0def3e0123e92cee41bd9b6dde8bf2a75 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 20 Jun 2016 18:32:47 +0200 Subject: erts: Optimize spawn driver for large(r) environments that need to be enqueued. --- erts/emulator/sys/unix/sys_drivers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'erts/emulator/sys/unix') 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); } -- cgit v1.2.3 From 4fb4d6c57a987f58915f21af5a6321c5228b45dc Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 21 Jun 2016 19:07:23 +0200 Subject: erts: Add test port_SUITE:pipe_limit_env for 9f779819f6bda734c595. --- erts/emulator/sys/unix/sys_drivers.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'erts/emulator/sys/unix') diff --git a/erts/emulator/sys/unix/sys_drivers.c b/erts/emulator/sys/unix/sys_drivers.c index e08ef41817..3d7be020e1 100644 --- a/erts/emulator/sys/unix/sys_drivers.c +++ b/erts/emulator/sys/unix/sys_drivers.c @@ -688,6 +688,10 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, return ERL_DRV_ERROR_ERRNO; } + /* + * Whitebox test port_SUITE:pipe_limit_env + * assumes this command payload format. + */ io_vector[i].iov_base = (void*)&buffsz; io_vector[i++].iov_len = sizeof(buffsz); -- cgit v1.2.3