diff options
author | John Högberg <[email protected]> | 2017-11-03 11:49:27 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2017-11-30 15:44:33 +0100 |
commit | ebbd26eeea4115c946d1254d94acd50f150b4455 (patch) | |
tree | ab2a8ba1023aa0684695dc36ff5567ae9e3f59c4 /bootstrap | |
parent | 6cb62e44eba1db8d1917ebb0db84298e91582c4e (diff) | |
download | otp-ebbd26eeea4115c946d1254d94acd50f150b4455.tar.gz otp-ebbd26eeea4115c946d1254d94acd50f150b4455.tar.bz2 otp-ebbd26eeea4115c946d1254d94acd50f150b4455.zip |
Reimplement efile_drv as a dirty NIF
This improves the latency of file operations as dirty schedulers
are a bit more eager to run jobs than async threads, and use a
single global queue rather than per-thread queues, eliminating the
risk of a job stalling behind a long-running job on the same thread
while other async threads sit idle.
There's no such thing as a free lunch though; the lowered latency
comes at the cost of increased busy-waiting which may have an
adverse effect on some applications. This behavior can be tweaked
with the +sbwt flag, but unfortunately it affects all types of
schedulers and not just dirty ones. We plan to add type-specific
flags at a later stage.
sendfile has been moved to inet_drv to lessen the effect of a nasty
race; the cooperation between inet_drv and efile has never been
airtight and the socket dying at the wrong time (Regardless of
reason) could result in fd aliasing. Moving it to the inet driver
makes it impossible to trigger this by closing the socket in the
middle of a sendfile operation, while still allowing it to be
aborted -- something that can't be done if it stays in the file
driver.
The race still occurs if the controlling process dies in the short
window between dispatching the sendfile operation and the dup(2)
call in the driver, but it's much less likely to happen now.
A proper fix is in the works.
--
Notable functional differences:
* The use_threads option for file:sendfile/5 no longer has any
effect.
* The file-specific DTrace probes have been removed. The same
effect can be achieved with normal tracing together with the
nif__entry/nif__return probes to track scheduling.
--
OTP-14256
Diffstat (limited to 'bootstrap')
-rw-r--r-- | bootstrap/bin/no_dot_erlang.boot | bin | 5607 -> 5905 bytes | |||
-rw-r--r-- | bootstrap/bin/start.boot | bin | 5607 -> 5905 bytes | |||
-rw-r--r-- | bootstrap/bin/start_clean.boot | bin | 5607 -> 5905 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/file.beam | bin | 14080 -> 14052 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/file_io_server.beam | bin | 15040 -> 15412 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/file_server.beam | bin | 5348 -> 5104 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/kernel.app | 7 | ||||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io.beam | bin | 0 -> 1724 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_compressed.beam | bin | 0 -> 2364 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_deflate.beam | bin | 0 -> 2708 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_delayed.beam | bin | 0 -> 5432 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_inflate.beam | bin | 0 -> 4256 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_list.beam | bin | 0 -> 2576 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/raw_file_io_raw.beam | bin | 0 -> 396 bytes |
14 files changed, 7 insertions, 0 deletions
diff --git a/bootstrap/bin/no_dot_erlang.boot b/bootstrap/bin/no_dot_erlang.boot Binary files differindex a49298d260..2b909efb58 100644 --- a/bootstrap/bin/no_dot_erlang.boot +++ b/bootstrap/bin/no_dot_erlang.boot diff --git a/bootstrap/bin/start.boot b/bootstrap/bin/start.boot Binary files differindex a49298d260..2b909efb58 100644 --- a/bootstrap/bin/start.boot +++ b/bootstrap/bin/start.boot diff --git a/bootstrap/bin/start_clean.boot b/bootstrap/bin/start_clean.boot Binary files differindex a49298d260..2b909efb58 100644 --- a/bootstrap/bin/start_clean.boot +++ b/bootstrap/bin/start_clean.boot diff --git a/bootstrap/lib/kernel/ebin/file.beam b/bootstrap/lib/kernel/ebin/file.beam Binary files differindex 6d45887800..6afd377023 100644 --- a/bootstrap/lib/kernel/ebin/file.beam +++ b/bootstrap/lib/kernel/ebin/file.beam diff --git a/bootstrap/lib/kernel/ebin/file_io_server.beam b/bootstrap/lib/kernel/ebin/file_io_server.beam Binary files differindex 74a62d6388..4d13d35d76 100644 --- a/bootstrap/lib/kernel/ebin/file_io_server.beam +++ b/bootstrap/lib/kernel/ebin/file_io_server.beam diff --git a/bootstrap/lib/kernel/ebin/file_server.beam b/bootstrap/lib/kernel/ebin/file_server.beam Binary files differindex d609725fa8..f17b888898 100644 --- a/bootstrap/lib/kernel/ebin/file_server.beam +++ b/bootstrap/lib/kernel/ebin/file_server.beam diff --git a/bootstrap/lib/kernel/ebin/kernel.app b/bootstrap/lib/kernel/ebin/kernel.app index 68dcf6b930..55445f83c6 100644 --- a/bootstrap/lib/kernel/ebin/kernel.app +++ b/bootstrap/lib/kernel/ebin/kernel.app @@ -88,6 +88,13 @@ inet_udp, inet_sctp, pg2, + raw_file_io, + raw_file_io_compressed, + raw_file_io_deflate, + raw_file_io_delayed, + raw_file_io_inflate, + raw_file_io_list, + raw_file_io_raw, seq_trace, standard_error, wrap_log_reader]}, diff --git a/bootstrap/lib/kernel/ebin/raw_file_io.beam b/bootstrap/lib/kernel/ebin/raw_file_io.beam Binary files differnew file mode 100644 index 0000000000..734a051882 --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_compressed.beam b/bootstrap/lib/kernel/ebin/raw_file_io_compressed.beam Binary files differnew file mode 100644 index 0000000000..caa3d9ac6b --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_compressed.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_deflate.beam b/bootstrap/lib/kernel/ebin/raw_file_io_deflate.beam Binary files differnew file mode 100644 index 0000000000..eb487b1fb0 --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_deflate.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_delayed.beam b/bootstrap/lib/kernel/ebin/raw_file_io_delayed.beam Binary files differnew file mode 100644 index 0000000000..45b9586251 --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_delayed.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_inflate.beam b/bootstrap/lib/kernel/ebin/raw_file_io_inflate.beam Binary files differnew file mode 100644 index 0000000000..f348054060 --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_inflate.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_list.beam b/bootstrap/lib/kernel/ebin/raw_file_io_list.beam Binary files differnew file mode 100644 index 0000000000..283f3b892d --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_list.beam diff --git a/bootstrap/lib/kernel/ebin/raw_file_io_raw.beam b/bootstrap/lib/kernel/ebin/raw_file_io_raw.beam Binary files differnew file mode 100644 index 0000000000..b47a67055d --- /dev/null +++ b/bootstrap/lib/kernel/ebin/raw_file_io_raw.beam |