From 0371d8e6fb2545843e73125eb2d0edaf8fd3e778 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 4 May 2016 21:03:16 +0200 Subject: erts: Refactor ERTS_ALC_INFO_A_* constants as an enum and replace _MAX with _END --- erts/emulator/beam/erl_alloc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'erts') diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index f571515def..40b36e4b6c 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -137,10 +137,12 @@ static ErtsAllocatorState_t exec_alloc_state; #endif static ErtsAllocatorState_t test_alloc_state; -#define ERTS_ALC_INFO_A_ALLOC_UTIL (ERTS_ALC_A_MAX + 1) -#define ERTS_ALC_INFO_A_MSEG_ALLOC (ERTS_ALC_A_MAX + 2) -#define ERTS_ALC_INFO_A_ERTS_MMAP (ERTS_ALC_A_MAX + 3) -#define ERTS_ALC_INFO_A_MAX ERTS_ALC_INFO_A_ERTS_MMAP +enum { + ERTS_ALC_INFO_A_ALLOC_UTIL = ERTS_ALC_A_MAX + 1, + ERTS_ALC_INFO_A_MSEG_ALLOC, + ERTS_ALC_INFO_A_ERTS_MMAP, + ERTS_ALC_INFO_A_END +}; typedef struct { erts_smp_atomic32_t refc; @@ -150,7 +152,7 @@ typedef struct { Process *proc; Eterm ref; Eterm ref_heap[REF_THING_SIZE]; - int allocs[ERTS_ALC_INFO_A_MAX - ERTS_ALC_A_MIN + 1 + 1]; + int allocs[ERTS_ALC_INFO_A_END - ERTS_ALC_A_MIN + 1]; } ErtsAllocInfoReq; ERTS_SCHED_PREF_QUICK_ALLOC_IMPL(aireq, @@ -3359,7 +3361,7 @@ erts_request_alloc_info(struct process *c_p, int internal) { ErtsAllocInfoReq *air = aireq_alloc(); - Eterm req_ai[ERTS_ALC_INFO_A_MAX+1] = {0}; + Eterm req_ai[ERTS_ALC_INFO_A_END] = {0}; Eterm alist; Eterm *hp; int airix = 0, ai; -- cgit v1.2.3 From c93da5e4fb98f92b9693586dda2ce1bf2d05ade1 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 4 May 2016 21:13:08 +0200 Subject: erts: Show exec_alloc as disabled when not used --- erts/emulator/beam/erl_alloc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index 40b36e4b6c..d7919b9db0 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -141,6 +141,7 @@ enum { ERTS_ALC_INFO_A_ALLOC_UTIL = ERTS_ALC_A_MAX + 1, ERTS_ALC_INFO_A_MSEG_ALLOC, ERTS_ALC_INFO_A_ERTS_MMAP, + ERTS_ALC_INFO_A_DISABLED_EXEC, /* fake a disabled "exec_alloc" */ ERTS_ALC_INFO_A_END }; @@ -3262,6 +3263,12 @@ reply_alloc_info(void *vair) am_false); #endif break; +#ifndef ERTS_ALC_A_EXEC + case ERTS_ALC_INFO_A_DISABLED_EXEC: + alloc_atom = erts_bld_atom(hpp, szp, "exec_alloc"); + ainfo = erts_bld_tuple2(hpp, szp, alloc_atom, am_false); + break; +#endif default: alloc_atom = erts_bld_atom(hpp, szp, (char *) ERTS_ALC_A2AD(ai)); @@ -3289,7 +3296,8 @@ reply_alloc_info(void *vair) switch (ai) { case ERTS_ALC_A_SYSTEM: case ERTS_ALC_INFO_A_ALLOC_UTIL: - case ERTS_ALC_INFO_A_ERTS_MMAP: + case ERTS_ALC_INFO_A_ERTS_MMAP: + case ERTS_ALC_INFO_A_DISABLED_EXEC: break; case ERTS_ALC_INFO_A_MSEG_ALLOC: #if HAVE_ERTS_MSEG && defined(ERTS_SMP) @@ -3401,6 +3409,12 @@ erts_request_alloc_info(struct process *c_p, ai = ERTS_ALC_INFO_A_ERTS_MMAP; goto save_alloc; } +#ifndef ERTS_ALC_A_EXEC + if (erts_is_atom_str("exec_alloc", alloc, 0)) { + ai = ERTS_ALC_INFO_A_DISABLED_EXEC; + goto save_alloc; + } +#endif if (erts_is_atom_str("alloc_util", alloc, 0)) { ai = ERTS_ALC_INFO_A_ALLOC_UTIL; save_alloc: -- cgit v1.2.3 From 725ffcf9a638d8b15295f0a3709f2e786663c987 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 10 May 2016 16:12:59 +0200 Subject: erts: Fix doc typo in erts_alloc --- erts/doc/src/erts_alloc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml index 70775b9f0f..9aef1c0b1f 100644 --- a/erts/doc/src/erts_alloc.xml +++ b/erts/doc/src/erts_alloc.xml @@ -583,7 +583,7 @@

The following flag is special for exec_alloc:

- ]]> + ]]> exec_alloc super carrier size (in MB). The amount of virtual address space reserved for native executable code -- cgit v1.2.3 From 3d85de7d6bd60e6b409be6910b35d973206ef388 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 10 May 2016 16:16:47 +0200 Subject: erts: Skip alloc_SUITE:erts_mmap if ERL_ZFLAGS contains flags for super carrier +MMsc* --- erts/emulator/test/alloc_SUITE.erl | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'erts') diff --git a/erts/emulator/test/alloc_SUITE.erl b/erts/emulator/test/alloc_SUITE.erl index 1f7b499dcb..84cf4921d3 100644 --- a/erts/emulator/test/alloc_SUITE.erl +++ b/erts/emulator/test/alloc_SUITE.erl @@ -73,16 +73,32 @@ migration(Cfg) -> end. erts_mmap(Config) when is_list(Config) -> - case os:type() of - {unix, _} -> + case {os:type(), mmsc_flags()} of + {{unix,_}, false} -> [erts_mmap_do(Config, SCO, SCRPM, SCRFSD) || SCO <-[true,false], SCRFSD <-[1234,0], SCRPM <- [true,false]]; - {SkipOs,_} -> + {{unix,_}, Flags} -> + {skipped, Flags}; + {{SkipOs,_},_} -> {skipped, lists:flatten(["Not run on " | io_lib:format("~p",[SkipOs])])} end. +%% Check if there are ERL_FLAGS set that will mess up this test case +mmsc_flags() -> + case mmsc_flags("ERL_FLAGS") of + false -> mmsc_flags("ERL_ZFLAGS"); + Flags -> Flags + end. +mmsc_flags(Env) -> + case os:getenv(Env) of + false -> false; + V -> case string:str(V, "+MMsc") of + 0 -> false; + P -> Env ++ "=" ++ string:substr(V, P) + end + end. erts_mmap_do(Config, SCO, SCRPM, SCRFSD) -> %% We use the number of schedulers + 1 * approx main carriers size -- cgit v1.2.3 From cbee76c388d08100856a92f14850bb3302a51207 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 12 May 2016 19:20:41 +0200 Subject: erts: Remove compiler warning 'hx' may be used uninitialized --- erts/emulator/beam/beam_load.c | 1 + 1 file changed, 1 insertion(+) (limited to 'erts') diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 2e21a553ed..e6b50fbd32 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -4368,6 +4368,7 @@ gen_get_map_elements(LoaderState* stp, GenOpArg Fail, GenOpArg Src, int good_hash; #endif + ERTS_UNDEF(hx, 0); ASSERT(Size.type == TAG_u); NEW_GENOP(stp, op); -- cgit v1.2.3