aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/common/erl_poll.c
AgeCommit message (Collapse)Author
2019-02-01Fix EV_DISPATCH detection on NetBSDLukas Larsson
2019-01-21erts: Fix getting of poll events on linux >= 4.15.0Lukas Larsson
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-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-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-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-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.
2017-10-30erts: Fix a bunch of compiler warningsLukas 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: Move all I/O polling to a seperate threadLukas Larsson
2017-09-15erts: Rename ErtsPollSet_ structS to not confuse gdbSverker Eriksson
by having different structs with same name.
2017-07-17erts: Replace usage of all erts_smp prefixes to just ertsLukas Larsson
2017-07-17erts: Cleanup removal of non-smp emulatorsLukas Larsson
2017-07-17erts: Remove ERTS_SMP and USE_THREAD definesLukas Larsson
This refactor was done using the unifdef tool like this: for file in $(find erts/ -name *.[ch]); do unifdef -t -f defile -o $file $file; done where defile contained: #define ERTS_SMP 1 #define USE_THREADS 1 #define DDLL_SMP 1 #define ERTS_HAVE_SMP_EMU 1 #define SMP 1 #define ERL_BITS_REENTRANT 1 #define ERTS_USE_ASYNC_READY_Q 1 #define FDBLOCK 1 #undef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT #define ERTS_POLL_ASYNC_INTERRUPT_SUPPORT 0 #define ERTS_POLL_USE_WAKEUP_PIPE 1 #define ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE 1 #undef ERTS_HAVE_PLAIN_EMU #undef ERTS_SIGNAL_STATE
2017-07-06Allow toggling lock counting at runtimeJohn Högberg
The implementation is still hidden behind ERTS_ENABLE_LOCK_COUNT, and all categories are still enabled by default, but the actual counting can be toggled at will. OTP-13170
2017-01-19erts: Handle SIGUSR1 via signal service insteadBjörn-Egil Dahlberg
2016-06-22Improve accuracy of timeouts using premature timeoutsRickard Green
Improve accuracy of timeouts using a premature timeout then return to sleep with a shorter timeout just before requested timeout. This approach is only used on certain platforms where we know it improves the accuracy of the timeouts, e.g. MacOS X.
2016-03-15update copyright-yearHenrik Nord
2016-02-02erts: Add microstate accountingLukas Larsson
Microstate accounting is a way to track which state the different threads within ERTS are in. The main usage area is to pin point performance bottlenecks by checking which states the threads are in and then from there figuring out why and where to optimize. Since checking whether microstate accounting is on or off is relatively expensive if done in a short loop only a few of the states are enabled by default and more states can be enabled through configure. I've done some benchmarking and the overhead with it turned off is not noticible and with it on it is a fraction of a percent. If you enable the extra states, depending on the benchmark, the ovehead when turned off is about 1% and when turned on somewhere inbetween 5-15%. OTP-12345
2015-06-29Merge branch 'maint-17' into maintSverker Eriksson
Conflicts: OTP_VERSION erts/doc/src/notes.xml erts/vsn.mk otp_versions.table
2015-06-25Merge branch 'sverk/poll-lost-wakeup/OTP-12859' into maint-17Erlang/OTP
* sverk/poll-lost-wakeup/OTP-12859: erts: Fix race in poller thread wake up
2015-06-22erts: Fix race in poller thread wake upSverker Eriksson
2015-06-22Merge branch 'bruce/change-license'Bruce Yinhe
OTP-12845 * bruce/change-license: fix errors caused by changed line numbers Change license text to APLv2
2015-06-20erts: Fix erl_poll on darwinBjörn-Egil Dahlberg
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-17erts: Refactor growth of fd tablesSverker Eriksson
to have one common implementation for both _kp and _nkp.
2015-05-11Merge branch 'egil/erts/high_accuracy_sleep/OTP-12236'Björn-Egil Dahlberg
* egil/erts/high_accuracy_sleep/OTP-12236: erts: Add high accuracy poll timeouts
2015-05-08Optimized timer implementationRickard Green
2015-04-13erts: Add high accuracy poll timeoutsLukas Larsson
Different poll/select implementations have different ways to handle timeouts of < ms accuracy. Most have extended API like pselect or such, while others rely on using timerfds (epoll_wait). If no high accuracy timeout is available, we simply round up to nearest ms. If we do not roundup we will spin the last ms when waiting for a timeout which is not desirable.
2015-03-20Introduce a new time APIRickard Green
The old time API is based on erlang:now/0. The major issue with erlang:now/0 is that it was intended to be used for so many unrelated things. This tied these unrelated operations together and unnecessarily caused performance, scalability as well as accuracy, and precision issues for operations that do not need to have such issues. The new API spreads different functionality over multiple functions in order to improve on this. The new API consists of a number of new BIFs: - erlang:convert_time_unit/3 - erlang:monotonic_time/0 - erlang:monotonic_time/1 - erlang:system_time/0 - erlang:system_time/1 - erlang:time_offset/0 - erlang:time_offset/1 - erlang:timestamp/0 - erlang:unique_integer/0 - erlang:unique_integer/1 - os:system_time/0 - os:system_time/1 and a number of extensions of existing BIFs: - erlang:monitor(time_offset, clock_service) - erlang:system_flag(time_offset, finalize) - erlang:system_info(os_monotonic_time_source) - erlang:system_info(time_offset) - erlang:system_info(time_warp_mode) - erlang:system_info(time_correction) - erlang:system_info(start_time) See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
2014-08-22Fix ERTS_POLL_DEBUG_PRINT usageMichael Truog
2013-12-02Silence a warning in erl_poll about an empty loop bodyAnthony Ramine
The warning is: sys/common/erl_poll.c:2513:72: warning: for loop has empty body [-Wempty-body] for (prev_ps = pollsets; ps != prev_ps->next; prev_ps = prev_ps->next);
2013-09-04erts: Fix faulty assert in "unlimited select" for macSverker Eriksson
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-04erts: Fix dynamic select for darwinSverker Eriksson
Make sure the fd-sets (read and write) are of equal size.
2013-05-28erts: Refactor unlimited select patchSverker Eriksson
An attempt to beautify the code by reducing the amount of #ifdef's in the hot code path.
2013-05-28erts: Fix bug in unlimited fd_set patchSverker Eriksson
2013-05-12Use _DARWIN_UNLIMITED_SELECT in erl_pollAnthony Ramine
This allows erl_poll to select() on file descriptors greater than FD_SETSIZE (1024) on Darwin. The fd sets are manually (re)allocated and freed.
2012-08-31Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: lib/diameter/autoconf/vxworks/sed.general xcomp/README.md
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-07-18erts: Remove VxWorks support from beamBjörn-Egil Dahlberg
2012-06-18Make allocation of check_io tables more scalable.Rick Reed
2012-03-27Fix wakeup functionality in no thread support caseRickard Green
2011-12-27Include wakeup pipe in /dev/poll poll-set also on non-SMPRickard Green
I/O events could potentially be delayed for ever when enabling kernel-poll on a non-SMP runtime system executing on Solaris. When also combined with async-threads the runtime system hung before completing the boot phase. This bug was introduced in erts-5.9/OTP-R15B.
2011-12-02Fix time typesRickard Green
2011-11-13Optimize memory allocationRickard Green
A number of memory allocation optimizations have been implemented. Most optimizations reduce contention caused by synchronization between threads during allocation and deallocation of memory. Most notably: * Synchronization of memory management in scheduler specific allocator instances has been rewritten to use lock-free synchronization. * Synchronization of memory management in scheduler specific pre-allocators has been rewritten to use lock-free synchronization. * The 'mseg_alloc' memory segment allocator now use scheduler specific instances instead of one instance. Apart from reducing contention this also ensures that memory allocators always create memory segments on the local NUMA node on a NUMA system.
2011-10-14Merge branch 'rickard/atomics-api/OTP-9014' and OTP_R14B04Rickard Green
Conflicts: erts/aclocal.m4 erts/emulator/beam/erl_db.c erts/emulator/sys/win32/sys.c erts/include/internal/ethread_header_config.h.in
2011-09-06Changes inspired by running cppcheck(1)Christian von Roques