aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process.c
AgeCommit message (Collapse)Author
2016-03-11Merge branch 'vinoski/ds-avoid-lock'Rickard Green
* vinoski/ds-avoid-lock: Skip run queue lock check for dirty schedulers
2016-03-10Improved scheduler suspend functionalityRickard Green
- The calling process is now suspended while synchronizing scheduler suspends via erlang:system_flag(schedulers_online, _) and erlang:system_flag(multi_scheduling, _), instead of blocking the scheduler thread in the BIF call waiting for the operation to synchronize. Besides releasing the scheduler for other work (or immediate suspend) it also makes it possible to abort the operation by killing the process. - erlang:system_flag(schedulers_online, _) now only wait for normal schedulers to complete before it returns. This since it may take a very long time before all dirty schedulers suspends. - erlang:system_flag(multi_scheduling, block_normal|unblock_normal) which only operate on normal schedulers has been introduced. This since there are use cases where suspend of dirty schedulers are not of interest (hipe loader). - erlang:system_flag(multi_scheduling, block) still blocks all dirty schedulers as well as all normal schedulers except one since it is hard to redefine what multi scheduling block means. - The three operations: - changing amount of schedulers online - blocking/unblocking normal multi scheduling - blocking/unblocking full multi scheduling can now be done in parallel. This is important since otherwise a full multi scheduling block would potentially delay the other operations for a very long time.
2016-03-01Merge branch 'sverk/master/halt-INT_MIN'Sverker Eriksson
* sverk/master/halt-INT_MIN: erts: Make erlang:halt() accept bignums as Status erts: Change erl_exit into erts_exit kernel: Remove calls to erl_exit
2016-02-25Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: erts/emulator/beam/erl_alloc.types erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_process.c erts/preloaded/ebin/erts_internal.beam
2016-02-25Merge branch 'egil/heart-callback/OTP-13250' into maintBjörn-Egil Dahlberg
2016-02-24Merge branch 'master' into sverk/master/halt-INT_MINSverker Eriksson
2016-02-24erts: Change erl_exit into erts_exitSverker Eriksson
This is mostly a pure refactoring. Except for the buggy cases when calling erlang:halt() with a positive integer in the range -(INT_MIN+2) to -INT_MIN that got confused with ERTS_ABORT_EXIT, ERTS_DUMP_EXIT and ERTS_INTR_EXIT. Outcome OLD erl_exit(n, ) NEW erts_exit(n, ) ------- ------------------- ------------------------------------------- exit(Status) n = -Status <= 0 n = Status >= 0 crashdump+abort n > 0, ignore n n = ERTS_ERROR_EXIT < 0 The outcome of the old ERTS_ABORT_EXIT, ERTS_INTR_EXIT and ERTS_DUMP_EXIT are the same as before (even though their values have changed).
2016-02-24Merge branch 'maint'Rickard Green
* maint: Do not wait for main lock when looking up process not running
2016-02-23Do not wait for main lock when looking up process not runningRickard Green
2016-02-21Skip run queue lock check for dirty schedulersSteve Vinoski
The wake_scheduler function asserts that the run queue is not locked, but this assertion sometimes fails for dirty schedulers (in January 2016 a user in erlang-questions reported a dirty schedulers problem related to this). After discussing it with Rickard, we decided modifying the assertion was the most practical way to address the problem.
2016-02-16erts: Add BIF erts_internal:system_check/1Björn-Egil Dahlberg
This commit implements erts_internal:system_check(schedulers) with the intent of a basic responsiveness test check of the schedulers.
2016-02-15Merge branch 'rickard/ds-fixes' into rickard/ds-fixes-masterRickard Green
* rickard/ds-fixes: Fix unique_SUITE for dirty schedulers Add dirty scheduler process termination test Ensure that work is done on the correct type of schedulers Conflicts: erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_process_dump.c
2016-02-15Ensure that work is done on the correct type of schedulersRickard Green
Only the actual call to the dirty nif is allowed to execute on dirty schedulers. The dirty nif is not allowed to execute on normal schedulers if dirty schedulers are available. Arrival of exit signals and system tasks, while a process was scheduled for execution on a dirty scheduler, could mess up the process internal state. Preparation for dirty system task has been made, but is currently unused.
2016-02-08Merge branch 'maint'Sverker Eriksson
2016-02-08Merge branch 'sverk/proc-exiting-timer-race/OTP-13245' into maintSverker Eriksson
* sverk/proc-exiting-timer-race/OTP-13245: erts: Fix race between receive timeout and exit signal
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
2016-02-02erts: Add ERTS_WRITE_UNLIKELYLukas Larsson
ERTS_WRITE_UNLIKELY can be used to place global variables in a specific section where only data that is very rarely modified sits. This is used to improve cache locality.
2016-02-02Merge branch 'maint'Rickard Green
* maint: Introduce time management in native APIs Introduce time warp safe replacement for safe_fixed option Introduce time warp safe trace timestamp formats Conflicts: erts/emulator/beam/erl_bif_trace.c erts/emulator/beam/erl_driver.h erts/emulator/beam/erl_nif.h erts/emulator/beam/erl_trace.c erts/preloaded/ebin/erlang.beam
2016-02-02Merge branch 'rickard/monotonic-time-improvements/OTP-13222' into maintRickard Green
* rickard/monotonic-time-improvements/OTP-13222: Introduce time management in native APIs Introduce time warp safe replacement for safe_fixed option Introduce time warp safe trace timestamp formats
2016-01-20Introduce time warp safe trace timestamp formatsRickard Green
New timestamp options for trace, sequential trace, and system profile: - monotonic_timestamp - strict_monotonic_timestamp
2016-01-20Merge branch 'maint'Rickard Green
* maint: Fix dirty scheduler check in handle_aux_work
2016-01-19Merge branch 'sverk/safe-purging/OTP-13122'Sverker Eriksson
* sverk/safe-purging/OTP-13122: erts: Ignore unexpected messages to erts_code_purger erts: Optimize erlang:check_process_code erts: Refactor check_process_code/3 erts: Make copy_literals more fail safe erts: Move copy_literals/2 from erlang to erts_internal erts: Make erlang:purge_module/1 safe erts: Refactor code:purge/1 and code:soft_purge/1 erts: Introduce erts_code_purger
2016-01-18Fix dirty scheduler check in handle_aux_workSteve Vinoski
2016-01-18erts: Fix race between receive timeout and exit signalSverker Eriksson
Must re-read 'state' after seizing proc locks as other thread may have set EXITING.
2016-01-14Merge branch 'maint'Rickard Green
* maint: Do not allow aux work on dirty schedulers
2016-01-14Merge branch 'vinoski/dirty-sched-no-aux-work/OTP-13236' into maintRickard Green
* vinoski/dirty-sched-no-aux-work/OTP-13236: Do not allow aux work on dirty schedulers
2016-01-13erts: Optimize erlang:check_process_codeSverker Eriksson
by ignoring literals. erts_internal:check_process_code will be called again anyway (with option {copy_literals, true}) before the module is actually purged. No need to check literals twice.
2015-12-30Merge branch 'maint'Rickard Green
* maint: Light weight statistics of run queue lengths Conflicts: erts/preloaded/ebin/erlang.beam
2015-12-30Light weight statistics of run queue lengthsRickard Green
- statistics(total_run_queue_lengths) - statistics(run_queue_lengths) - statistics(total_active_tasks) - statistics(active_tasks) Conflicts: erts/emulator/beam/erl_process.c
2015-12-21Do not allow aux work on dirty schedulersSteve Vinoski
The nature of aux work is such that dirty schedulers should not attempt to perform it. Modify the code to ensure that dirty schedulers avoid aux work. Also fix an incorrect assumption about the size of a Uint in the ErtsDirtySchedId type.
2015-12-15Merge branch 'lukas/erts/forker'Lukas Larsson
* lukas/erts/forker: (28 commits) erts: Never abort in the forked child erts: Mend ASSERT makro for erl_child_setup erts: Allow enomem failures in port_SUITE erts: iter_port sleep longer on freebsd erts: Allow one dangling fd if there is a gethost port erts: Only use forker StackAck on freebsd erts: It is not possible to exit the forker driver erts: Add forker StartAck for port start flowcontrol erts: Fix large open_port arg segfault for win32 erts: Fix memory leak at async open port kernel: Remove cmd server for unix os:cmd erts: Add testcase for huge port environment erts: Move os_pid to port hash to child setup erts: Handle all EINTR and EAGAIN cases in child setup erts: Make child_setup work with large environments erts: Fix forker driver ifdefs for win32 erts: Fix uds socket handling for os x erts: Fix dereferencing of unaligned integer for sparc erts: Flatten too long io vectors in uds write erts: Add fd count test for spawn_driver ... Conflicts: erts/emulator/beam/erl_node_tables.c erts/preloaded/src/erts_internal.erl
2015-12-15erts: Create forker process for spawn driverLukas Larsson
Instead of forking from the beam process, we create a separate process in which all forks are done. This has several advantages: 1) performance: * don't have to close all fd's in the world * fork only has to copy stuff from a small process * work is done in a completely seperate process * a 3x performance increase has been measured, can be made even greater (10x) if we cache the environment in child setup 2) stability * the exec is done in another process than beam, which means that if the file that we exec to is on an nfs that is not available right now we will not block a scheduler until the nfs returns. 3) simplicity * don't have to deal with SIGCHLD in the erts Unfortunately, this solution also implies some badness. 1) There will always be a seperate process running together with beam on unix. This could be confusing and undesirable. 2) We have to transfer the entire environment to child_setup for each command. OTP-13088
2015-12-08Merge branch 'rickard/ohmq-fixup/OTP-13047'Rickard Green
* rickard/ohmq-fixup/OTP-13047: Replace off_heap_message_queue option with message_queue_data option Always use literal_alloc Distinguish between GC disabled by BIFs and other disabled GC Fix process_info(_, off_heap_message_queue) Off heap message queue test suite Remove unused variable Fix memory leaks
2015-12-08Replace off_heap_message_queue option with message_queue_data optionRickard Green
The message_queue_data option can have the values - off_heap - on_heap - mixed
2015-12-08Distinguish between GC disabled by BIFs and other disabled GCRickard Green
Processes remember heap fragments that are known to be fully live due to creation in a just called BIF that yields in the live_hf_end field. This field must not be used if we have not disabled GC in a BIF. F_DELAY_GC has been introduced in order to distinguish between to two different scenarios. - F_DISABLE_GC should *only* be used by BIFs. This when the BIF needs to yield while preventig a GC. - F_DELAY_GC should only be used when GC is temporarily disabled while the process is scheduled. A process must not be scheduled out while F_DELAY_GC is set.
2015-12-08Remove unused variableRickard Green
2015-12-08Fix memory leaksRickard Green
2015-12-02Merge branch 'egil/fix-seq_trace'Björn-Egil Dahlberg
* egil/fix-seq_trace: Fix seq_trace token copy size Fix seq_trace refactoring bug
2015-11-26Merge branch 'maint'Sverker Eriksson
2015-11-24Fix seq_trace token copy sizeBjörn-Egil Dahlberg
2015-11-24Fix seq_trace refactoring bugBjörn-Egil Dahlberg
2015-11-19Refactor have seq_trace token testBjörn-Egil Dahlberg
2015-11-18Use sharing preserving copy error messages and exceptionsBjörn-Egil Dahlberg
2015-11-18Refactor sharing preserved copy flagsBjörn-Egil Dahlberg
The TMPBUF option is no longer needed due to is_literal test and NONE was only used for initial debugging. So we remove the entire option.
2015-11-17Refactor copy sharingBjörn-Egil Dahlberg
2015-11-17Add -debug +vc flag for debuging SHCOPYNikolaos S. Papaspyrou
This is very verbose, you have been warned. It should work with the copy-spy.py script, which may be a bit outdated.
2015-11-17Enable shcopy for spawning processesNikolaos S. Papaspyrou
2015-11-13Merge branch 'rickard/gc-bump-reds/OTP-13097'Rickard Green
* rickard/gc-bump-reds/OTP-13097: Bump reductions on GC
2015-11-12Merge branch 'rickard/ohmq/OTP-13047'Rickard Green
* rickard/ohmq/OTP-13047: Fragmented young heap generation and off_heap_message_queue option Refactor GC Introduce literal tag Conflicts: erts/doc/src/erlang.xml erts/emulator/beam/erl_gc.c
2015-11-12Bump reductions on GCRickard Green