Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
6742-beam-remove-allocator-wrappers.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 6742-beam-remove-allocator-wrappers.patch of Package erlang
From 19a51d21179f7ca07eb90d23ef749cdb52cca141 Mon Sep 17 00:00:00 2001 From: Maxim Fedorov <maximfca@gmail.com> Date: Fri, 7 Jan 2022 17:36:56 -0800 Subject: [PATCH 2/3] [beam] remove allocator wrappers It was only used by memory tracing feature that has also been removed. --- erts/emulator/beam/erl_alloc.c | 51 ----------------------------- erts/emulator/beam/erl_alloc.h | 19 ----------- erts/emulator/beam/erl_alloc_util.c | 6 ---- 3 files changed, 76 deletions(-) diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index 08f825312a..f3c091646f 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -654,9 +654,6 @@ erts_alloc_init(int *argc, char **argv, ErtsAllocInitOpts *eaiop) if (ncpu < 1) ncpu = 1; - erts_tsd_key_create(&erts_allctr_prelock_tsd_key, - "erts_allctr_prelock_tsd_key"); - erts_sys_alloc_init(); erts_init_utils_mem(); @@ -3439,54 +3436,6 @@ badarg: return res; } -/* - * The allocator wrapper prelocking stuff below is about the locking order. - * It only affects wrappers (erl_mtrace.c) that keep locks during - * alloc/realloc/free. - * - * Some query functions in erl_alloc_util.c lock the allocator mutex and then - * use erts_printf that in turn may call the sys allocator through the wrappers. - * To avoid breaking locking order these query functions first "pre-locks" all - * allocator wrappers. - */ -ErtsAllocatorWrapper_t *erts_allctr_wrappers; -int erts_allctr_wrapper_prelocked = 0; -erts_tsd_key_t erts_allctr_prelock_tsd_key; - -void erts_allctr_wrapper_prelock_init(ErtsAllocatorWrapper_t* wrapper) -{ - ASSERT(wrapper->lock && wrapper->unlock); - wrapper->next = erts_allctr_wrappers; - erts_allctr_wrappers = wrapper; -} - -void erts_allctr_wrapper_pre_lock(void) -{ - if (erts_allctr_wrappers) { - ErtsAllocatorWrapper_t* wrapper = erts_allctr_wrappers; - for ( ; wrapper; wrapper = wrapper->next) { - wrapper->lock(); - } - ASSERT(!erts_allctr_wrapper_prelocked); - erts_allctr_wrapper_prelocked = 1; - erts_tsd_set(erts_allctr_prelock_tsd_key, (void*)1); - } -} - -void erts_allctr_wrapper_pre_unlock(void) -{ - if (erts_allctr_wrappers) { - ErtsAllocatorWrapper_t* wrapper = erts_allctr_wrappers; - - erts_allctr_wrapper_prelocked = 0; - erts_tsd_set(erts_allctr_prelock_tsd_key, (void*)0); - for ( ; wrapper; wrapper = wrapper->next) { - wrapper->unlock(); - } - } -} - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * NOTE: erts_alc_test() is only supposed to be used for testing. * * * diff --git a/erts/emulator/beam/erl_alloc.h b/erts/emulator/beam/erl_alloc.h index c0c1890b0a..78591f633d 100644 --- a/erts/emulator/beam/erl_alloc.h +++ b/erts/emulator/beam/erl_alloc.h @@ -164,18 +164,6 @@ typedef struct { extern ErtsAllocatorThrSpec_t erts_allctr_thr_spec[ERTS_ALC_A_MAX+1]; -typedef struct ErtsAllocatorWrapper_t_ { - void (*lock)(void); - void (*unlock)(void); - struct ErtsAllocatorWrapper_t_* next; -}ErtsAllocatorWrapper_t; -extern ErtsAllocatorWrapper_t *erts_allctr_wrappers; -extern int erts_allctr_wrapper_prelocked; -extern erts_tsd_key_t erts_allctr_prelock_tsd_key; -void erts_allctr_wrapper_prelock_init(ErtsAllocatorWrapper_t* wrapper); -void erts_allctr_wrapper_pre_lock(void); -void erts_allctr_wrapper_pre_unlock(void); - void erts_alloc_register_scheduler(void *vesdp); void erts_alloc_scheduler_handle_delayed_dealloc(void *vesdp, int *need_thr_progress, @@ -320,13 +308,6 @@ void *erts_realloc_fnf(ErtsAlcType_t type, void *ptr, Uint size) return res; } -ERTS_ALC_INLINE -int erts_is_allctr_wrapper_prelocked(void) -{ - return erts_allctr_wrapper_prelocked /* locked */ - && !!erts_tsd_get(erts_allctr_prelock_tsd_key); /* by me */ -} - #ifdef ERTS_HAVE_IS_IN_LITERAL_RANGE ERTS_ALC_FORCE_INLINE diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c index 9c32308a7c..5d14519890 100644 --- a/erts/emulator/beam/erl_alloc_util.c +++ b/erts/emulator/beam/erl_alloc_util.c @@ -5522,13 +5522,11 @@ erts_alcu_info_options(Allctr_t *allctr, ensure_atoms_initialized(allctr); if (allctr->thread_safe) { - erts_allctr_wrapper_pre_lock(); erts_mtx_lock(&allctr->mutex); } res = info_options(allctr, print_to_p, print_to_arg, hpp, szp); if (allctr->thread_safe) { erts_mtx_unlock(&allctr->mutex); - erts_allctr_wrapper_pre_unlock(); } return res; } @@ -5561,7 +5559,6 @@ erts_alcu_sz_info(Allctr_t *allctr, ensure_atoms_initialized(allctr); if (allctr->thread_safe) { - erts_allctr_wrapper_pre_lock(); erts_mtx_lock(&allctr->mutex); } @@ -5599,7 +5596,6 @@ erts_alcu_sz_info(Allctr_t *allctr, if (allctr->thread_safe) { erts_mtx_unlock(&allctr->mutex); - erts_allctr_wrapper_pre_unlock(); } return res; @@ -5632,7 +5628,6 @@ erts_alcu_info(Allctr_t *allctr, ensure_atoms_initialized(allctr); if (allctr->thread_safe) { - erts_allctr_wrapper_pre_lock(); erts_mtx_lock(&allctr->mutex); } @@ -5687,7 +5682,6 @@ erts_alcu_info(Allctr_t *allctr, if (allctr->thread_safe) { erts_mtx_unlock(&allctr->mutex); - erts_allctr_wrapper_pre_unlock(); } return res; -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor