aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
AgeCommit message (Collapse)Author
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-02-26Merge branch 'bjorn/multiple-load/OTP-13111'Björn Gustavsson
* bjorn/multiple-load/OTP-13111: code: Add functions that can load multiple modules Refactor post_beam_load handling Simplify and robustify code_server:all_loaded/1 Update preloaded modules Add erl_prim_loader:get_modules/3 Add has_prepared_code_on_load/1 BIF Allow erlang:finish_loading/1 to load more than one module beam_load.c: Add a function to check for an on_load function
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-25Update preloaded modulesBjörn Gustavsson
2016-02-25Add erl_prim_loader:get_modules/3Björn Gustavsson
When we are going to implement functions that can load many modules at once, we don't the erl_prim_loader server to become a bottleneck. Therefore, we need erl_prim_loader:get_modules/3 that can read many BEAM files in parallel. Note that we will not bother making reading from archive files or using the inet loader efficient. That can be done later if it turns out to be important.
2016-02-25Add has_prepared_code_on_load/1 BIFBjörn Gustavsson
2016-02-24Merge branch 'maint'Hans Bolinder
* maint: Update preloaded module typos Conflicts: erts/preloaded/ebin/prim_file.beam
2016-02-24Update preloaded moduleHans Bolinder
2016-02-22Merge branch 'maint'Hans Bolinder
* maint: Fix a few dialyzer warnings
2016-02-22Fix a few dialyzer warningsHans Bolinder
2016-02-17Update preloaded modulesHans Bolinder
2016-02-16Update preloaded erts_internal.beamBjörn-Egil Dahlberg
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-08Merge branch 'sverk/safe-purging/OTP-13122'Sverker Eriksson
* sverk/safe-purging/OTP-13122: erts: Fix harmless dialyzer warnings
2016-02-02Update preloaded modulesLukas Larsson
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, kernel: Add os:perf_counter functionLukas Larsson
The perf_counter is a very very cheap and high resolution timer that can be used to timestamp system events. It does not have monoticity guarantees, but should on most OS's expose a monotonous time. A special instruction has been created for this counter to further speed up fetching it. OTP-12908
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-01-26Update preloaded modulesLukas Larsson
2016-01-26Merge branch 'lukas/erts/gc_info/OTP-13265'Lukas Larsson
* lukas/erts/gc_info/OTP-13265: erts: Add garbage_collection_info to process_info/2 Conflicts: erts/emulator/beam/erl_bif_info.c
2016-01-25erts: Fix harmless dialyzer warningsSverker Eriksson
2016-01-21Update preloaded modulesBjörn Gustavsson
2016-01-20erl_prim_loader: Rename release_archives/0Björn Gustavsson
Rename release_archives/0 to purge_archive_cache/0 to make it clearer what it does and what it doesn't do. Also add a comment about its intended purpose. Note that release_archives/0 is not documented and is part of the experimental archive feature. Furthermore, the only uses I could find were in the test suite. I did not find any uses in the external applications relx and rebar3 applications that are known to use archives. Therefore, I think that the increased clarity is worth the small risk of breaking code.
2016-01-20erl_prim_loader: Correct timeout handling for efileBjörn Gustavsson
The timeout routine for efile was never called. While at it, eliminate the n_timeouts field and simplify the logic.
2016-01-20erl_prim_loader: Correct purging of the archive cacheBjörn Gustavsson
prim_do_release_archives/3 can't make up its mind whether the primary archive should be released or not. The key in the process dictionary is kept, while #prim_state.primary_archive is cleared. It seems that intent was the primary archive should be preserved, because the function was intended to be called by a timeout routine every sixth minute (it is not because of a bug in setting up the timeout). Therefore, rewrite the code to preserve the primary archive and simplify it while at it. Also, rename prim_release_archives/1 to prim_purge_cache/0 to make it clearer what it is doing.
2016-01-20erl_prim_loader: Remove unused 'cache' fieldBjörn Gustavsson
The #prim_state.cache' field is unused. The actual cache is kept in the process dictionary.
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-19erts: Ignore unexpected messages to erts_code_purgerSverker Eriksson
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.
2016-01-13erts: Refactor check_process_code/3Sverker Eriksson
Move impl from erlang to erts_internal. Cut and paste.
2016-01-13erts: Make copy_literals more fail safeSverker Eriksson
* Same process must do enable-disable. * System process will force it and never get 'aborted'
2016-01-13erts: Move copy_literals/2 from erlang to erts_internalSverker Eriksson
as it's not a public interface.
2016-01-13erts: Make erlang:purge_module/1 safeSverker Eriksson
Problem: erlang:purge_module/1 is not safe in the sense that very bad things may happen if the code to be purged is still referred to by live processes. Introduce erts_internal:purge_module which is the same as the old erlang:purge_module BIF (except it returns false if no such old module). Implement erlang:purge_module in Erlang and let it invoke erts_code_purger for safe purging where all clogging processes first are killed.
2016-01-13erts: Refactor code:purge/1 and code:soft_purge/1Sverker Eriksson
by moving code from code_server to erts_code_purger. This is more or less a copy-paste from code_server.erl to erts_code_purger.erl. All the inner mechanics of code:purge/1 and code:soft_purge/1 are unchanged.
2016-01-13erts: Introduce erts_code_purgerSverker Eriksson
as a system process with preloaded code.
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-16Update preloaded modulesBjörn Gustavsson
2015-12-16erl_prim_loader: Clean up string_match()Björn Gustavsson
Part of the return value for string_match/3 is not used by its only caller. Eliminate the unused part of the return value and the accumulator argument for string_match().
2015-12-16erl_prim_loader: Avoid making absolute pathsBjörn Gustavsson
We don't need absolute paths unless we are dealing with archives. Since it is not free to turn a relative path absolute (we will need a call to prim_file to fetch the current directory), it's better to delay the call to absname/1 until we are sure it's needed.
2015-12-16erl_prim_loader: Clean up splitting of filenamesBjörn Gustavsson
2015-12-16init: Eliminate the concat/1 functionBjörn Gustavsson
There is no need to use the concat/1 function since all arguments that are passed to it have known types.
2015-12-16Clean up start of erl_prim_loaderBjörn Gustavsson
The 'init' module fetches command line parameters and passes them to erl_prim_loader:start/3. The code can be simplified if 'init' calls a new erl_prim_loader:start/0 function that itself fetches the necessary command line parameters. Also remove the documentation for the start() function, since it there is no way that it can be usefully called by a user application. While we are at it, also get rid of '-id' command line parameter, which is fetched and stored but never actually used.
2015-12-16Remove erl_prim_loader:get_files/2Björn Gustavsson
erl_prim_loader:get_files/2 was an optimization introduced before the SMP emulator (that is, before R11). The idea was to use the async threads in the efile driver to read multiple BEAM files from the disk in parallel. In a modern computer with the SMP emulator, loading a BEAM module seems to be more time-consuming than reading it from disk. To optimize loading we would need to load several modules in parallel. We could modify get_files/2 so that it would support parallel loading, but it is cleaner to first remove get_files/2 and then (in a future commit), introduce new functions to support parallel loading.
2015-12-16erl_prim_loader: Remove code for handling OSEBjörn Gustavsson
2015-12-16erl_prim_loader: Break loop/3 into two functions for readabilityBjörn Gustavsson
The deep indentation makes loop/3 difficult to read and maintain. Break out the request handling code into a separate function.
2015-12-16prim_file: Suppress a dialyzer warningBjörn Gustavsson
Kostis Sagonas pointed out that there is a dialyzer warning for constructing an improper list in the following clause: translate_response(?FILE_RESP_N2DATA = X, [<<_:64, _:64, _:64>> | <<>>] = Data) -> {error, {bad_response_from_port, [X | Data]}}; I don't want to change the code to somehow eliminate the warning. An improper list has already been constructed in the efile driver itself, and that would be difficult to fix. Therefore, tell dialyzer to ignore warnings for improper lists in translate_response/2.
2015-12-16Reduce the ludicrous number of arguments for eval_script()Björn Gustavsson
The compact wall of arguments makes it hard to see what is actually happening in eval_script(). Collect the arguments into a record.
2015-12-16Clean up handling of boot_varsBjörn Gustavsson
Expansion of $ROOT in paths are handled specially compared to boot variables. There is no reason $ROOT can't be handled as a boot variable. We can simplify the expansion of boot variables if we spend a little extra effort upfront collecting all boot variables into a map. Make the error checking for -boot_var arguments stricter. Only allow -boot_var followed by exactly two arguments to help users catch errors earlier.