aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_init.c
AgeCommit message (Collapse)Author
2017-02-06Merge branch 'maint'Rickard Green
* maint: Use a hole-marker that cannot be mistaken for a valid term on the heap
2017-02-06Merge branch 'rickard/hole-marker' into maintRickard Green
* rickard/hole-marker: Use a hole-marker that cannot be mistaken for a valid term on the heap
2017-02-03Use a hole-marker that cannot be mistaken for a valid term on the heapRickard Green
2017-02-03Merge branch 'maint'Björn-Egil Dahlberg
2017-02-03Fix merge commitBjörn-Egil Dahlberg
This fixes commit f0867aa2ccbbf5677e0577bba08f8b7bc53ec0ed
2017-02-03erge branch 'maint'Hans Nilsson
Conflicts: OTP_VERSION
2017-02-03Merge branch 'maint-18' into maintHans Nilsson
Conflicts: OTP_VERSION erts/doc/src/notes.xml erts/emulator/sys/unix/erl_unix_sys.h erts/emulator/sys/unix/sys.c erts/vsn.mk lib/crypto/c_src/crypto.c lib/crypto/doc/src/notes.xml lib/crypto/vsn.mk lib/inets/doc/src/notes.xml lib/inets/vsn.mk lib/ssh/doc/src/notes.xml lib/ssh/src/ssh.app.src lib/ssh/src/ssh_connection_handler.erl lib/ssh/vsn.mk otp_versions.table
2017-02-01Merge branch 'egil/erts/fix_scheduler_suspend/ERL-94/PR-978/OTP-13425' into ↵Erlang/OTP
maint-18 * egil/erts/fix_scheduler_suspend/ERL-94/PR-978/OTP-13425: erts: Fix install of suspend handler
2017-01-25Merge branch 'maint'Björn-Egil Dahlberg
2017-01-20erts: Fix thread suspend in crashdumpBjörn-Egil Dahlberg
* move signal handler setup
2016-11-25Merge branch 'maint'Rickard Green
* maint: Fix initialization dependencies between time, lock-check and lcnt
2016-11-25Merge branch 'rickard/init-bug/OTP-13911' into maintRickard Green
* rickard/init-bug/OTP-13911: Fix initialization dependencies between time, lock-check and lcnt Conflicts: erts/emulator/sys/unix/sys.c
2016-11-22Merge branch 'maint'Sverker Eriksson
2016-11-22erts: Add env variable ERL_CRASH_DUMP_BYTESSverker Eriksson
to limit crash dump size
2016-09-26Fix initialization dependencies between time, lock-check and lcntRickard Green
2016-09-05Merge branch 'bjorn/erts/help-clang'Björn Gustavsson
* bjorn/erts/help-clang: Slightly reduce code size of process_main()
2016-09-01Slightly reduce code size of process_main()Björn Gustavsson
clang will generate smaller code if we avoid reassigning the reg and freg arrays. That can be easily arranged by passing them as arguments to process_main().
2016-08-31erts: Fix install of suspend handlerLukas Larsson
This commit makes sure to setup the suspend handler to matter what +B option is given at the command line.
2016-08-31Remove old purge strategyRickard Green
2016-08-29Merge branch 'rickard/ds-purge-module/OTP-13808' into maintRickard Green
* rickard/ds-purge-module/OTP-13808: Perform check_process_code while process is executing dirty Conflicts: erts/doc/src/erl_nif.xml
2016-08-29Merge branch 'rickard/fun-purge-bug/OTP-13809' and ↵Rickard Green
'rickard/new-purge-strategy/OTP-13833' into maint * rickard/fun-purge-bug/OTP-13809: Fix purge of code Reclaim literal area after purge has completed Separate literal area from code Conflicts: erts/doc/src/erlang.xml erts/emulator/beam/beam_bif_load.c erts/emulator/beam/erl_init.c erts/preloaded/ebin/init.beam
2016-08-29Perform check_process_code while process is executing dirtyRickard Green
2016-08-29Fix purge of codeRickard Green
Ensure that we cannot get any dangling pointers into code that has been purged. This is done by a two phase purge. At first phase all fun entries pointing into the code to purge are marked for purge. All processes trying to call these funs will be suspended and by this we avoid getting new direct references into the code. When all processes has been checked, these processes are resumed. The new purge strategy now also completely ignore the existence of indirect references to the code (funs). If such exist, they will cause bad fun exceptions to the caller, but will not prevent a soft purge or cause a kill of a process having such live references during a hard purge. This since it is impossible to give any guarantees that no processes in the system have such indirect references. Even when the system is completely clean from such references, new ones can appear via distribution and/or disk.
2016-08-26Reclaim literal area after purge has completedRickard Green
2016-08-12Merge branch 'maint-19' into maintRickard Green
* maint-19: Updated OTP version Prepare release Avoid segfault when printing slogan after crashdumping Fix race causing lost wakeup on receive-after timeout
2016-08-11Merge branch 'rickard/erl-crash-dump-bug/OTP-13799' into maint-18Erlang/OTP
* rickard/erl-crash-dump-bug/OTP-13799: Avoid segfault when printing slogan after crashdumping
2016-08-11Merge branch 'rickard/erl-crash-dump-bug/OTP-13799' into maint-19Erlang/OTP
* rickard/erl-crash-dump-bug/OTP-13799: Avoid segfault when printing slogan after crashdumping
2016-08-11Avoid segfault when printing slogan after crashdumpingRickard Green
2016-07-14hipe: Remove performance profiling codeLukas Larsson
This type of statistics is now available through the microstate accounting API.
2016-05-25Remove the 'message_queue_data' option 'mixed'Rickard Green
2016-05-10erts: Implement max_heap_size process flagLukas Larsson
The max_heap_size process flag can be used to limit the growth of a process heap by killing it before it becomes too large to handle. It is possible to set the maximum using the `erl +hmax` option, `system_flag(max_heap_size, ...)`, `spawn_opt(Fun, [{max_heap_size, ...}])` and `process_flag(max_heap_size, ...)`. It is possible to configure the behaviour of the process when the maximum heap size is reached. The process may be sent an untrappable exit signal with reason kill and/or send an error_logger message with details on the process state. A new trace event called gc_max_heap_size is also triggered for the garbage_collection trace flag when the heap grows larger than the configured size. If kill and error_logger are disabled, it is still possible to see that the maximum has been reached by doing garbage collection tracing on the process. The heap size is defined as the sum of the heap memory that the process is currently using. This includes all generational heaps, the stack, any messages that are considered to be part of the heap and any extra memory the garbage collector may need during collection. In the current implementation this means that when a process is set using on_heap message queue data mode, the messages that are in the internal message queue are counted towards this value. For off_heap, only matched messages count towards the size of the heap. For mixed, it depends on race conditions within the VM whether a message is part of the heap or not. Below is an example run of the new behaviour: Eshell V8.0 (abort with ^G) 1> f(P),P = spawn_opt(fun() -> receive ok -> ok end end, [{max_heap_size, 512}]). <0.60.0> 2> erlang:trace(P, true, [garbage_collection, procs]). 1 3> [P ! lists:duplicate(M,M) || M <- lists:seq(1,15)],ok. ok 4> =ERROR REPORT==== 26-Apr-2016::16:25:10 === Process: <0.60.0> Context: maximum heap size reached Max heap size: 512 Total heap size: 723 Kill: true Error Logger: true GC Info: [{old_heap_block_size,0}, {heap_block_size,609}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}] flush(). Shell got {trace,<0.60.0>,gc_start, [{old_heap_block_size,0}, {heap_block_size,233}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}]} Shell got {trace,<0.60.0>,gc_max_heap_size, [{old_heap_block_size,0}, {heap_block_size,609}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}]} Shell got {trace,<0.60.0>,exit,killed}
2016-05-04Merge branch 'rickard/reds-fix/master/OTP-13512'Rickard Green
* rickard/reds-fix/master/OTP-13512: Ensure correct reduction counting
2016-05-04Ensure correct reduction countingRickard Green
2016-04-26erts: Rename erl flag +xmqd to +hmqdLukas Larsson
Flags that control the heap should all fall under the +h flag
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-03-18Merge branch 'lukas/erts/fix_scheduler_suspend/ERL-94/PR-978/OTP-13425'Lukas Larsson
* lukas/erts/fix_scheduler_suspend/ERL-94/PR-978/OTP-13425: erts: Fix install of suspend handler Conflicts: erts/emulator/sys/unix/erl_unix_sys.h erts/emulator/sys/unix/sys.c
2016-03-15update copyright-yearHenrik Nord
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-23erts: Fix install of suspend handlerLukas Larsson
This commit makes sure to setup the suspend handler to matter what +B option is given at the command line.
2016-02-08Merge branch 'sverk/thread-unsafe-alloc'Sverker Eriksson
* sverk/thread-unsafe-alloc: erts: Fix faulty assert for non-smp erts: Add checks for thread safe allocation
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-01-21erts: Add checks for thread safe allocationSverker Eriksson
Assert thread unsafe allocator is only created on non-smp and only called by the main thread. Removed test of unsafe allocator in custom thread.
2016-01-13erts: Introduce erts_code_purgerSverker Eriksson
as a system process with preloaded code.
2016-01-07Merge branch 'sverk/proc-dict-opt'Sverker Eriksson
OTP-13167 * sverk/proc-dict-opt: erts: Add new test case pdict_SUITE:mixed erts: Add 'fill_heap' to erts_debug:state_internal_state erts: Rename proc dict size to arraySize erts: Refactor proc dict with 'usedSlots' erts: Add sizeMask for faster proc dict indexing erts: Remove ProcDict.used erts: Add proc dict macros ERTS_PD_START/SIZE erts: Optimize away function "array_put" in proc dict erts: Optimize hashing in process dictionary
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-09erts: Optimize hashing in process dictionarySverker Eriksson
by limiting table sizes to powers of 2. This will change the default size from 10 to 8.
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