aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/alloc_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-10-15 15:19:43 +0200
committerSverker Eriksson <[email protected]>2013-10-15 15:19:43 +0200
commit356c1e9312a640ac211b6d5d4110372742acfcde (patch)
tree1961a33422f0f4bdae6c1bc647b93a2441fe41e0 /erts/emulator/test/alloc_SUITE.erl
parentbbe80d2ad4ef0ca607ba557102212cb7c9a06e2c (diff)
parent5db2c05af6efaf636b2e41e3a1f305c592a71f34 (diff)
downloadotp-356c1e9312a640ac211b6d5d4110372742acfcde.tar.gz
otp-356c1e9312a640ac211b6d5d4110372742acfcde.tar.bz2
otp-356c1e9312a640ac211b6d5d4110372742acfcde.zip
Merge branch 'rickard-sverker/supercarrier/OTP-11149' into maint
* rickard-sverker/supercarrier/OTP-11149: (29 commits) erts: Add test case for erts_mmap erts: Add mutex to init_atoms in erts_mmap.c erts: Fix lock violation for init_atoms in erl_mmap.c erts: Fix misc minor bugs in supercarrier initialization erts: Add erts_mmap stats erts: Add erts_bld_tupleX macros erts: Rename erts_bld_atom_uint_2tup_list to *_uword_* erts: Fix bug in lookup_free_seg erts: Fix race bug in erts_munmap erts: Add HARD_DBG_MSEG erts: Refactor rbt_insert in erl_mmap erts: erts_mmap improved free seg desc management erts: Add documentation for +MMsc* system flags erts: Allow page aligned erts_munmap() erts: Sort tree in super aligned sizes (SA_SZ_ADDR_ORDER) erts: Fix ASSERT bug and void* arithmetics erts: Add mmap argument to erts_debug:get_internal_state erts: Improve erts_mmap out of free descriptor management erts: Cleanup erl_mmap erts: Add __func__ to ERTS_ASSERT macro ...
Diffstat (limited to 'erts/emulator/test/alloc_SUITE.erl')
-rw-r--r--erts/emulator/test/alloc_SUITE.erl69
1 files changed, 66 insertions, 3 deletions
diff --git a/erts/emulator/test/alloc_SUITE.erl b/erts/emulator/test/alloc_SUITE.erl
index 801ed0f85a..f6ff6bb813 100644
--- a/erts/emulator/test/alloc_SUITE.erl
+++ b/erts/emulator/test/alloc_SUITE.erl
@@ -29,6 +29,7 @@
bucket_mask/1,
rbtree/1,
mseg_clear_cache/1,
+ erts_mmap/1,
cpool/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
@@ -41,7 +42,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[basic, coalesce, threads, realloc_copy, bucket_index,
- bucket_mask, rbtree, mseg_clear_cache, cpool].
+ bucket_mask, rbtree, mseg_clear_cache, erts_mmap, cpool].
groups() ->
[].
@@ -110,6 +111,59 @@ cpool(suite) -> [];
cpool(doc) -> [];
cpool(Cfg) -> ?line drv_case(Cfg).
+erts_mmap(Config) when is_list(Config) ->
+ case {?t:os_type(), is_halfword_vm()} of
+ {{unix, _}, false} ->
+ [erts_mmap_do(Config, SCO, SCRPM, SCMGC)
+ || SCO <-[true,false], SCMGC <-[1234,0], SCRPM <- [true,false]];
+
+ {_,true} ->
+ {skipped, "No supercarrier support on halfword vm"};
+ {SkipOs,_} ->
+ ?line {skipped,
+ lists:flatten(["Not run on "
+ | io_lib:format("~p",[SkipOs])])}
+ end.
+
+
+erts_mmap_do(Config, SCO, SCRPM, SCMGC) ->
+ SCS = 100, % Mb
+ O1 = "+MMscs" ++ integer_to_list(SCS)
+ ++ " +MMsco" ++ atom_to_list(SCO)
+ ++ " +MMscrpm" ++ atom_to_list(SCRPM),
+ Opts = case SCMGC of
+ 0 -> O1;
+ _ -> O1 ++ " +MMscmgc"++integer_to_list(SCMGC)
+ end,
+ {ok, Node} = start_node(Config, Opts),
+ Self = self(),
+ Ref = make_ref(),
+ F = fun () ->
+ SI = erlang:system_info({allocator,mseg_alloc}),
+ {erts_mmap,EM} = lists:keyfind(erts_mmap, 1, SI),
+ {supercarrier,SC} = lists:keyfind(supercarrier, 1, EM),
+ {sizes,Sizes} = lists:keyfind(sizes, 1, SC),
+ {free_segs,Segs} = lists:keyfind(free_segs,1,SC),
+ {total,Total} = lists:keyfind(total,1,Sizes),
+ Total = SCS*1024*1024,
+
+ {reserved,Reserved} = lists:keyfind(reserved,1,Segs),
+ true = (Reserved >= SCMGC),
+
+ case {SCO,lists:keyfind(os,1,EM)} of
+ {true, false} -> ok;
+ {false, {os,_}} -> ok
+ end,
+
+ Self ! {Ref, ok}
+ end,
+
+ spawn_link(Node, F),
+ Result = receive {Ref, Rslt} -> Rslt end,
+ stop_node(Node),
+ Result.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Internal functions %%
@@ -179,7 +233,9 @@ receive_drv_result(Port, CaseName) ->
?line {comment, Comment}
end.
-start_node(Config) when is_list(Config) ->
+start_node(Config) ->
+ start_node(Config, []).
+start_node(Config, Opts) when is_list(Config), is_list(Opts) ->
?line Pa = filename:dirname(code:which(?MODULE)),
?line {A, B, C} = now(),
?line Name = list_to_atom(atom_to_list(?MODULE)
@@ -191,7 +247,14 @@ start_node(Config) when is_list(Config) ->
++ integer_to_list(B)
++ "-"
++ integer_to_list(C)),
- ?line ?t:start_node(Name, slave, [{args, "-pa "++Pa}]).
+ ?line ?t:start_node(Name, slave, [{args, Opts++" -pa "++Pa}]).
stop_node(Node) ->
?t:stop_node(Node).
+
+is_halfword_vm() ->
+ case {erlang:system_info({wordsize, internal}),
+ erlang:system_info({wordsize, external})} of
+ {4, 8} -> true;
+ {WS, WS} -> false
+ end.