aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/common
AgeCommit message (Collapse)Author
2019-01-07erts: Add enif_select_read|write with 'msg_env' argumentSverker Eriksson
2018-12-20erts: Add ERL_NIF_SELECT_CUSTOM_MSGSverker Eriksson
2018-12-07Merge pull request #2046 from ↵John Högberg
jhogberg/john/erts/mark-pooled-free-blocks-unused/OTP-15075 Mark free blocks in pooled carriers as unused
2018-12-07Mark free blocks in pooled carriers as unused (MADV_FREE)John Högberg
This lets the OS reclaim the physical memory associated with these blocks which reduces the impact of long-lived awkward allocations. A small allocated block will still keep a huge carrier alive, but the unused part of the carrier will now be available to the OS. Co-authored-by: Dmytro Lytovchenko <[email protected]>
2018-12-06Merge branch 'maint'Lukas Larsson
Conflicts: erts/emulator/beam/erl_process.c
2018-12-06erts: Move fds with active true behaviour to own pollsetLukas Larsson
At start of the VM a poll-set that the schedulers will check is created where fds that have triggered many (at the moment, many means 10) times without being deselected inbetween. In this scheduler specific poll-set fds do not use ONESHOT, which means that the number of syscalls goes down dramatically for such fds. This pollset is introduced in order to handle fds that are used by the erlang distribution and that never change their state from {active, true}. This pollset only handles ready_input events, ready_output is still handled by the poll threads. During overload, polling the scheduler poll-set is done on a 10ms timer.
2018-12-03erts: Add erts_io_notify_port_task_executed to check_io msacc stateLukas Larsson
OTP-15450
2018-10-23erts: Pass thread progress data where possibleLukas Larsson
The poll thread does a lot of waking up and then going back to sleep. A large part of the waking up is managing thread progress and a large part of that was using thread specific data to get the thread progress data pointer. With this refactor the tpd is passed to each of the functions which greatly decreases the number of ethr_get_tsd calls which in turn halves the CPU usage of the poller thread in certain scenarios.
2018-09-21Merge branch 'maint'Henrik Nord
2018-09-21Update copyright yearHenrik Nord
2018-09-11Merge branch 'sverker/enif-cancel-select/OTP-15095'Sverker Eriksson
* sverker/enif-cancel-select/OTP-15095: erts: Add ERL_NIF_SELECT_CANCEL flag for enif_select
2018-08-27Fix bug in compact representation of float_to_list/2Serge Aleynikov
2018-08-03erts: Fix seq_trace to not clear token for system messagesLukas Larsson
A lot of erts internal messages used behind APIs to create non-blocking calls, e.g. port_command, would cause the seq_trace token to be cleared from the caller when it should not. This commit fixes that and adds asserts that makes sure that all messages sent have to correct token set. Fixes: ERL-602
2018-07-20erts: Add ERL_NIF_SELECT_CANCEL flag for enif_selectSverker Eriksson
to deselect read and/or writes without stop callback.
2018-07-03Use fallback pollset for stdin and friends when using kqueueJohn Högberg
This is a hack to make the "noshell" option work; kqueue can poll these fds but will not report EV_EOF. This may be common to all all pipes but we have no way to tell whether an fd is a pipe or not.
2018-06-21Fix environment case sensitivity issues on WindowsJohn Högberg
2018-06-18Update copyright yearHenrik Nord
2018-06-13erts: Fix MacOS pollset bugSverker Eriksson
that could cause clearing of fd-bits past allocated bit-vectors. Bug introduced on master by 988f5f5e8061ce2e135a314ca782788eda478a06
2018-06-04erts: Refactor usage of am_atom_put to ERTS_MAKE_AMSverker Eriksson
and let compiler determine string lengths. These were actually wrong in erl_db.c: count_trap\0 replace_tra select_tra
2018-04-25Merge branch 'lukas/erts/poll-thread/OTP-14346'Lukas Larsson
* lukas/erts/poll-thread/OTP-14346: erts: nif resource stop from poll-thread is a indirect call
2018-04-24erts: nif resource stop from poll-thread is a indirect callLukas Larsson
2018-04-19Optimize performance of float_to_list/2Serge Aleynikov
2018-04-12Merge PR-1770 from sverker/float_to_list-tweak/OTP-15015Sverker Eriksson
Improve float_to_list(F, [{decimals,D}])
2018-04-04erts: Fix float_to_list(F, [{decimals,D}])Sverker Eriksson
to better conform with io_lib:format("~.*f", [D,F])
2018-03-29erts: Don't use EV_DISPATCH on openbsdLukas Larsson
Currently (OpenBSD 6.2) the kqueu implementation on opnebsd does not work properly for EOF conditions when using EV_DISPATCH, so we use the EV_ONESHOT fallback there.
2018-03-21Merge pull request #1740 from rickard-green/rickard/signals/OTP-14589Rickard Green
Implementation of true asynchronous signaling between processes
2018-03-21Implementation of true asynchronous signaling between processesRickard Green
Communication between Erlang processes has conceptually always been performed through asynchronous signaling. The runtime system implementation has however previously preformed most operation synchronously. In a system with only one true thread of execution, this is not problematic (often the opposite). In a system with multiple threads of execution (as current runtime system implementation with SMP support) it becomes problematic. This since it often involves locking of structures when updating them which in turn cause resource contention. Utilizing true asynchronous communication often avoids these resource contention issues. The case that triggered this change was contention on the link lock due to frequent updates of the monitor trees during communication with a frequently used server. The signal order delivery guarantees of the language makes it hard to change the implementation of only some signals to use true asynchronous signaling. Therefore the implementations of (almost) all signals have been changed. Currently the following signals have been implemented as true asynchronous signals: - Message signals - Exit signals - Monitor signals - Demonitor signals - Monitor triggered signals (DOWN, CHANGE, etc) - Link signals - Unlink signals - Group leader signals All of the above already defined as asynchronous signals in the language. The implementation of messages signals was quite asynchronous to begin with, but had quite strict delivery constraints due to the ordering guarantees of signals between a pair of processes. The previously used message queue partitioned into two halves has been replaced by a more general signal queue partitioned into three parts that service all kinds of signals. More details regarding the signal queue can be found in comments in the erl_proc_sig_queue.h file. The monitor and link implementations have also been completely replaced in order to fit the new asynchronous signaling implementation as good as possible. More details regarding the new monitor and link implementations can be found in the erl_monitor_link.h file.
2018-03-05erts: Remove unused "executable" feature from ErtsMemMapperSverker Eriksson
No longer need for super carrier allocating executable memory.
2018-03-05erts: Remove hipe amd64 code super carrier (exec_mmap)Sverker Eriksson
2018-01-30erts: Remove low memory demand for hipe amd64 codeSverker Eriksson
2018-01-24Merge branch 'maint'Sverker Eriksson
2018-01-15erts: Refactor and cleanup sys_double_to_chars_fastSverker Eriksson
Replace long long with Uint64
2018-01-15erts: Fix float_to_list(F, [{decimals,D}]).Sverker Eriksson
Example symptom: 1> float_to_list(0.145, [{decimals,1}]). "0.2" There were two problems in sys_double_to_chars_fast 1. Most serious was adding 0.55555555 / (10^D) instead of 0.5 / (10^D) which imposed a 5.5% risk of a faulty rounding up. 2. Using fixpoint for frac_part which lost significant bits if F < 0.5
2018-01-03Replace the libc environment with a thread-safe emulationJohn Högberg
putenv(3) and friends aren't thread-safe regardless of how you slice it; a global lock around all environment operations (like before) keeps things safe as far as our own operations go, but we have absolutely no control over what libc or a library dragged in by a driver/NIF does -- they're free to call getenv(3) or putenv(3) without honoring our lock. This commit solves this by setting up an "emulated" environment which can't be touched without going through our interfaces. Third-party libraries can still shoot themselves in the foot but benign uses of os:putenv/2 will no longer risk crashing the emulator.
2017-10-30erts: Fix a bunch of compiler warningsLukas Larsson
2017-10-02erts: Trigger ready events when erts_io_control failsLukas Larsson
2017-10-02erts: disable kernel-poll on OS X vsn < 16Lukas Larsson
kqueue is broken on earlier versions of OS X.
2017-10-02erts: Add testcases to test IOp and IOt optionsLukas Larsson
2017-10-02erts: get_internal_state(check_io_debug) now prints to error_loggerLukas Larsson
2017-10-02erts: Move all I/O polling to a seperate threadLukas Larsson
2017-10-02erts: Add multiple poll setsSverker Eriksson
2017-09-15erts: Refactor check_io to use one static structSverker Eriksson
that is shared between _kp and _nkp versions. Makes it easier to access in debugger.
2017-09-15erts: Replace check_io spinlock with lock-less list insertionSverker Eriksson
2017-09-15erts: Add number of enif_select's to check_io_debugSverker Eriksson
2017-09-15erts: Remove undocumented driver_eventSverker Eriksson
2017-09-15erts: Refactor move check_io interface from sys to check_ioSverker Eriksson
# Conflicts: # erts/emulator/beam/erl_process.c # erts/emulator/beam/sys.h # erts/emulator/sys/common/erl_check_io.c # erts/emulator/sys/common/erl_check_io.h # erts/emulator/sys/unix/sys.c
2017-09-15erts: Rename ErtsPollSet_ structS to not confuse gdbSverker Eriksson
by having different structs with same name.
2017-09-15erts: Increase number of check_io-fd-locksSverker Eriksson
and use correct cache alignment.
2017-07-17erts: Replace usage of all erts_smp prefixes to just ertsLukas Larsson
2017-07-17erts: Cleanup removal of non-smp emulatorsLukas Larsson