From cabfe2cdc0b8d879431f81233addd2a43ff1f742 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Wed, 11 Sep 2013 21:49:32 +0200 Subject: Implement platform specific aligned sys_alloc and use when supported erts_sys_aligned_alloc() is currently implemented using posix_memalign if it exist, or using _aligned_malloc on Windows. If erts_sys_aligned_alloc() exist allocators will create sys_alloc carriers similar to how this was done pre-R16. --- erts/emulator/beam/erl_alloc.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'erts/emulator/beam/erl_alloc.c') diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index d748f86d75..13692edbfc 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -235,7 +235,6 @@ set_default_sbmbc_alloc_opts(struct au_init *ip) ip->init.bf.ao = 1; ip->init.util.ramv = 0; ip->init.util.mmsbc = 0; - ip->init.util.mmmbc = 500; ip->init.util.sbct = ~((UWord) 0); ip->init.util.name_prefix = "sbmbc_"; ip->init.util.alloc_no = ERTS_ALC_A_SBMBC; @@ -261,7 +260,6 @@ set_default_sl_alloc_opts(struct au_init *ip) ip->thr_spec = 1; ip->atype = GOODFIT; ip->init.util.name_prefix = "sl_"; - ip->init.util.mmmbc = 5; ip->init.util.alloc_no = ERTS_ALC_A_SHORT_LIVED; #ifndef SMALL_MEMORY ip->init.util.mmbcs = 128*1024; /* Main carrier size */ @@ -285,7 +283,6 @@ set_default_std_alloc_opts(struct au_init *ip) ip->thr_spec = 1; ip->atype = BESTFIT; ip->init.util.name_prefix = "std_"; - ip->init.util.mmmbc = 5; ip->init.util.alloc_no = ERTS_ALC_A_STANDARD; #ifndef SMALL_MEMORY ip->init.util.mmbcs = 128*1024; /* Main carrier size */ @@ -305,7 +302,6 @@ set_default_ll_alloc_opts(struct au_init *ip) ip->init.bf.ao = 1; ip->init.util.ramv = 0; ip->init.util.mmsbc = 0; - ip->init.util.mmmbc = 0; ip->init.util.sbct = ~((UWord) 0); ip->init.util.name_prefix = "ll_"; ip->init.util.alloc_no = ERTS_ALC_A_LONG_LIVED; @@ -353,7 +349,6 @@ set_default_eheap_alloc_opts(struct au_init *ip) ip->enable = AU_ALLOC_DEFAULT_ENABLE(1); ip->thr_spec = 1; ip->atype = GOODFIT; - ip->init.util.mmmbc = 100; ip->init.util.name_prefix = "eheap_"; ip->init.util.alloc_no = ERTS_ALC_A_EHEAP; #ifndef SMALL_MEMORY @@ -376,7 +371,6 @@ set_default_binary_alloc_opts(struct au_init *ip) ip->enable = AU_ALLOC_DEFAULT_ENABLE(1); ip->thr_spec = 1; ip->atype = BESTFIT; - ip->init.util.mmmbc = 50; ip->init.util.name_prefix = "binary_"; ip->init.util.alloc_no = ERTS_ALC_A_BINARY; #ifndef SMALL_MEMORY @@ -394,7 +388,6 @@ set_default_ets_alloc_opts(struct au_init *ip) ip->enable = AU_ALLOC_DEFAULT_ENABLE(1); ip->thr_spec = 1; ip->atype = BESTFIT; - ip->init.util.mmmbc = 100; ip->init.util.name_prefix = "ets_"; ip->init.util.alloc_no = ERTS_ALC_A_ETS; #ifndef SMALL_MEMORY @@ -462,13 +455,6 @@ adjust_tpref(struct au_init *ip, int no_sched) /* ... shrink smallest multi-block carrier size */ if (ip->default_.smbcs) ip->init.util.smbcs /= ERTS_MIN(4, no_sched); - /* ... and more than three allocators shrink - max mseg multi-block carriers */ - if (ip->default_.mmmbc && no_sched > 2) { - ip->init.util.mmmbc /= ERTS_MIN(4, no_sched - 1); - if (ip->init.util.mmmbc < 3) - ip->init.util.mmmbc = 3; - } } } @@ -2609,8 +2595,8 @@ erts_allocator_options(void *proc) #endif Uint sz, *szp, *hp, **hpp; Eterm res, features, settings; - Eterm atoms[ERTS_ALC_A_MAX-ERTS_ALC_A_MIN+5]; - Uint terms[ERTS_ALC_A_MAX-ERTS_ALC_A_MIN+5]; + Eterm atoms[ERTS_ALC_A_MAX-ERTS_ALC_A_MIN+6]; + Uint terms[ERTS_ALC_A_MAX-ERTS_ALC_A_MIN+6]; int a, length; SysAllocStat sas; Uint *endp = NULL; @@ -2723,6 +2709,9 @@ erts_allocator_options(void *proc) if (use_mseg) terms[length++] = am_atom_put("mseg_alloc", 10); #endif +#if ERTS_HAVE_ERTS_SYS_ALIGNED_ALLOC + terms[length++] = am_atom_put("sys_aligned_alloc", 17); +#endif features = length ? erts_bld_list(hpp, szp, length, terms) : NIL; -- cgit v1.2.3