aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc_util.c
AgeCommit message (Collapse)Author
2018-12-03erts: Fix some 32-bit gcc warningsLukas Larsson
2018-06-18Update copyright yearHenrik Nord
2018-04-23erts: Rewrite memory instrumentationJohn Högberg
This commit replaces the old memory instrumentation with a new implementation that scans carriers instead of wrapping erts_alloc/erts_free. The old implementation could not extract information without halting the emulator, had considerable runtime overhead, and the memory maps it produced were noisy and lacked critical information. Since the new implementation walks through existing data structures there's no longer a need to start the emulator with special flags to get information about carrier utilization/fragmentation. Memory fragmentation is also easier to diagnose as it's presented on a per-carrier basis which eliminates the need to account for "holes" between mmap segments. To help track allocations, each allocation can now be tagged with what it is and who allocated it at the cost of one extra word per allocation. This is controlled on a per-allocator basis with the +M<S>atags option, and is enabled by default for binary_alloc and driver_alloc (which is also used by NIFs).
2018-04-18erts: Fix rare deadlock in realloc when +ramv is enabledJohn Högberg
OTP-15024
2018-03-13Merge PR-1699 from sverker/hipe-amd64-high-code/OTP-14951Sverker Eriksson
Remove low memory need for HiPE on x86_64
2018-03-09Always use sys_memcpy/cmp/etc instead of plain memcpy/cmp/etcJohn Högberg
2018-03-05erts: Remove hipe amd64 code super carrier (exec_mmap)Sverker Eriksson
2018-02-12Merge 'sverker/maint-20/alloc-n-migration/ERIERL-88'Sverker Eriksson
into 'sverker/master/alloc-n-migration/ERIERL-88'
2018-02-12Merge 'sverker/maint-19/alloc-n-migration/ERIERL-88'Sverker Eriksson
into 'sverker/maint-20/alloc-n-migration/ERIERL-88' OTP-14915 OTP-14916 OTP-14917 OTP-14918
2018-02-12Merge 'sverker/carrier-migration-improvements'Sverker Eriksson
into 'sverker/maint-19/alloc-n-migration/ERIERL-88'
2018-02-12erts: Add system_flags(erts_alloc,"+M?sbct *")Sverker Eriksson
to change sbct limit in runtime for chosen allocator type. With great power comes great responsibility.
2018-02-08erts: Add migration options "acnl" and "acfml"Sverker Eriksson
acnl: Abandon Carrier Nr Limit acfml: Abandon Carrier Free block Min Limit
2017-12-20erts: Add more stats for mbcs_poolSverker Eriksson
similar to the ones in OTP-19.2.3.1
2017-12-20erts: Improve carrier pool searchSverker Eriksson
* Give back carrier to owner when put in pool with use of dd-queue. * Replace pooled_list with pooled_tree for more efficient search of all owned pooled carriers. * Remove traitor_list as it does not serve much purpose anymore. * Add HOMECOMING bit flag in crr->allctr atomic to (1) avoid double enqueue into dd-enqueue. (2) trigger read barrier in get_used_allctr for newly received carriers.
2017-12-20erts: Refactor carrier dealloc migrationSverker Eriksson
by adding a dedicated 'homecoming_dd_block' to use in dd-queue. + Preparation for dd-queue-migration of non-empty carriers. + Get rid of ugly hack where blk->carrier pointer is overwritten by dd-queue and then have to be restored.
2017-07-17erts: Replace usage of all erts_smp prefixes to just ertsLukas 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-06Merge branch 'john/erts/runtime-lcnt' into maintJohn Högberg
* john/erts/runtime-lcnt: Document rt_mask and add warnings about copy_save Add an emulator test suite for lock counting Break erts_debug:lock_counters/1 into separate BIFs Allow toggling lock counting at runtime Move lock flags to a common header Enable register_SUITE for lcnt builds Enable lcnt smoke test on all builds that have lcnt enabled Make lock counter info independent of the locks being counted OTP-14412 OTP-13170 OTP-14413
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-05-21erts: Make allocator functions staticSalikhov Dinislam
2017-05-04Update copyright yearRaimo Niskanen
2017-02-14Fixed typos in ertsAndrew Dryga
2016-12-02erts: Remove unnecessary 'enable_lcnt' option in locksBjörn-Egil Dahlberg
2016-11-23Merge branch 'maint'Rickard Green
* maint: Update etp-commands for dirty schedulers Fix scheduling of system tasks on processes executing dirty Fix call time tracing with dirty schedulers Fix send of exit signal to process executing dirty Fix dirty scheduler process priority Fix alloc-util hard-debug Silence debug warning when no beam jump table is used with dirty schedulers Fix check_process_code() when NifExport is in use Fix GC when NifExport is in use Fix saving of original arguments when rescheduling via NifExport Conflicts: erts/emulator/beam/beam_bif_load.c erts/emulator/beam/erl_nif.c
2016-11-23Merge branch 'rickard/dirty-scheduling-fixes' into maintRickard Green
OTP-14051 * rickard/dirty-scheduling-fixes: Update etp-commands for dirty schedulers Fix scheduling of system tasks on processes executing dirty Fix call time tracing with dirty schedulers Fix send of exit signal to process executing dirty Fix dirty scheduler process priority Fix alloc-util hard-debug Silence debug warning when no beam jump table is used with dirty schedulers Conflicts: erts/etc/unix/etp-commands.in
2016-11-22Fix alloc-util hard-debugRickard Green
2016-11-22Merge branch 'maint'Sverker Eriksson
2016-11-17erts: Fix all -Wundef errorsSverker Eriksson
2016-11-17erts: Refactor crash dumping with cbprintfSverker Eriksson
Instead of passing around a file descriptor use a function pointer to facilitate more advanced backend write logic such as size limitation or compression.
2016-10-17Merge branch 'sverker/hipe-code-loadnpurge/OTP-13968'Sverker Eriksson
* sverker/hipe-code-loadnpurge: (35 commits) erts: Cleanup dead code kernel,hipe: Fix dialyzer warnings erts: Replace unsafe Module.first_hipe_ref erts: Disable DBG_TRACE_MFA for debug build kernel: Fix code_SUITE:upgrade for non-hipe erts: Cleanup hipe trampoline code erts: Remove dead alloc stats in hipe_amd64.c erts: Remove code_SUITE:make_stub and make_stub_many_funs erts: Let code:make_stub_module raise 'notsup' erts: Fix bug in stack walk on risc erts: Fix old leak for ppc hipe code erts: Fix old leak for arm hipe code erts: Fix old leak of sparc hipe code erts: Fix old leak of hipe code on x86 32-bit erts: Enable exec_alloc for all hipe architectures erts: Remove debug printout for hipe loader state erts: Free hipe_refs and hipe_sdesc of a failed load erts: Refactor out hipe_purge_refs/sdesc erts: Refactor hipe_loader_state_dtor into a true destructor hipe: TRY fix llvm external calls to own module ...
2016-10-14erts: Enable exec_alloc for all hipe architecturesSverker Eriksson
For non-amd64 it's a "normal" allocator with a wrapper around mseg_alloc to call mprotect(PROT_EXEC).
2016-10-12erts: Add strict size assert to fix allocSverker Eriksson
and remove outdated min size adjustment. The is similar to lost commit 31bc414dc9639ccf94f9011ed32 except we now assume and assert strict size equality.
2016-04-26Merge branch 'lukas/erts/non-smp-debug-fixes/OTP-13047'Lukas Larsson
* lukas/erts/non-smp-debug-fixes/OTP-13047: erts: Fix incorrect non-smp debug assert erts: std_alloc is not thread safe on non-smp Conflicts: erts/emulator/beam/erl_alloc_util.c
2016-04-20Merge branch 'sverker/hipe-code-alloc'Sverker Eriksson
2016-04-20erts: Make sure literal MBCs have super aligned sizesSverker Eriksson
on 32-bit, as the granularity of the literal bit vector is super-alignment.
2016-04-15erts: Refactor callbacks for literal mseg allocSverker Eriksson
Make the callbacks more general to be usable for any allocator that that uses its own ErtsMemMapper.
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-04-06erts: Add lttng tracepoints for memory carriersBjörn-Egil Dahlberg
* carrier_create * carrier_destroy * carrier_pool_put * carrier_pool_get
2016-03-29erts: Fix incorrect non-smp debug assertLukas Larsson
2016-03-15update copyright-yearHenrik Nord
2016-03-08Merge branch 'maint'Sverker Eriksson
2016-03-08erts: Fix alloc_SUITE:rbtree and migration for win64Sverker Eriksson
One little (unsigned long) left behind.
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-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.
2015-11-27Merge branch 'maint'Sverker Eriksson
2015-11-12erts: Add support for fast erts_is_literal()Sverker Eriksson
2015-11-10erts: Add alloc_SUITE:migrationSverker Eriksson
2015-10-01erts: Fix confusion of callbacks destroying_mbc() vs remove_mbc()Sverker Eriksson
Problem #1 Goodfit was crippled by the fact that destroying_mbc() was called _before_ the carriers was unlinked from mbc_list. Problem #2 destroying_mbc() was called for carriers that later could be resurrected from dc_list without a matching call to creating_mbc(). This was mostly a practical problem for the new test case alloc_SUITE:migration that use the callbacks to create/destroy a mutex. Solution: destroying_mbc() is now only called just before a carrier is destroyed (deallocated or put in mseg cache). remove_mbc() is called both (like before) when inserted into cpool but now also when last block is freed and mbc is scheduled for destruction but may later be resurrected from dc_list.
2015-10-01erts: Fix resurrection of carriers from dc_listSverker Eriksson
Problem #1: Seems the dc_list check did end up as dead code by mistake. Solution: goto check_dc_list Problem #2: crr->cpool.max_size was set to zero for all carriers in dc_list, which meant no carriers were ever resurrected by cpool_fetch. Solution: Do not use callback 'largest_fblk_in_mbc' to set max_size as it will always return 0 (due to problem #3). Problem #3: Resurrected carriers were broken as their one free block was not linked. Solution: Link free block when fetching carrier from dc_list.