From a67e91e658bdbba24fcc3c79b06fdf10ff830bc9 Mon Sep 17 00:00:00 2001
From: Rickard Green
Date: Wed, 15 Sep 2010 22:14:51 +0200
Subject: Optimize memory allocation
A number of memory allocation optimizations have been implemented. Most
optimizations reduce contention caused by synchronization between
threads during allocation and deallocation of memory. Most notably:
* Synchronization of memory management in scheduler specific allocator
instances has been rewritten to use lock-free synchronization.
* Synchronization of memory management in scheduler specific
pre-allocators has been rewritten to use lock-free synchronization.
* The 'mseg_alloc' memory segment allocator now use scheduler specific
instances instead of one instance. Apart from reducing contention
this also ensures that memory allocators always create memory
segments on the local NUMA node on a NUMA system.
---
erts/doc/src/erts_alloc.xml | 58 +++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 34 deletions(-)
(limited to 'erts/doc')
diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml
index 86e1e5168a..3b5ee5391c 100644
--- a/erts/doc/src/erts_alloc.xml
+++ b/erts/doc/src/erts_alloc.xml
@@ -58,11 +58,8 @@
- Allocator used for memory blocks that are expected to be
long-lived, for example Erlang code.
fix_alloc
- - A very fast allocator used for some fix-sized
- data. fix_alloc manages a set of memory pools from
- which memory blocks are handed out. fix_alloc
- allocates memory pools from ll_alloc. Memory pools
- that have been allocated are never deallocated.
+ - A fast allocator used for some frequently used
+ fixed size data types.
std_alloc
- Allocator used for most memory blocks not allocated via any of
the other allocators described above.
@@ -83,7 +80,7 @@
where only small blocks are placed. Currently this allocator is
disabled by default.
- sys_alloc and fix_alloc are always enabled and
+
sys_alloc is always enabled and
cannot be disabled. mseg_alloc is always enabled if it is
available and an allocator that uses it is enabled. All other
allocators can be enabled or disabled.
@@ -104,7 +101,7 @@
The alloc_util framework
Internally a framework called alloc_util is used for
- implementing allocators. sys_alloc, fix_alloc, and
+ implementing allocators. sys_alloc, and
mseg_alloc do not use this framework; hence, the
following does not apply to them.
An allocator manages multiple areas, called carriers, in which
@@ -212,6 +209,14 @@
This since it will only cause problems for other allocators.
+ Apart from the ordinary allocators described above a number of
+ pre-allocators are used for some specific data types. These
+ pre-allocators pre-allocate a fixed amount of memory for certain data
+ types when the run-time system starts. As long as there are available
+ pre-allocated memory, it will be used. When no pre-allocated memory is
+ available, memory will be allocated in ordinary allocators. These
+ pre-allocators are typically much faster than the ordinary allocators,
+ but can only satisfy a limited amount of requests.
@@ -272,18 +277,6 @@
Max cached segments. The maximum number of memory segments
stored in the memory segment cache. Valid range is
0-30. Default value is 5.
- ]]>
- -
- Cache check interval (in milliseconds). The memory segment
- cache is checked for segments to destroy at an interval
- determined by this parameter. Default value is 1000.
-
-
The following flags are available for configuration of
- fix_alloc:
-
- +MFe true
- -
- Enable fix_alloc. Note: fix_alloc cannot be disabled.
The following flags are available for configuration of
sys_alloc:
@@ -322,7 +315,7 @@
based on alloc_util. If u is used as subsystem
identifier (i.e., = u]]>) all allocators based on
alloc_util will be effected. If B, D, E,
- H, L, R, S, or T is used as
+ F, H, L, R, S, or T is used as
subsystem identifier, only the specific allocator identified will be
effected:
@@ -441,26 +434,23 @@
kilobytes). See the description
on how sizes for mseg_alloc multiblock carriers are decided
in "the alloc_util framework" section.
- t true|false|]]>
+ t true|false]]>
-
-
Multiple, thread specific instances of the allocator.
- This option will only have any effect on the runtime system
- with SMP support. Default behaviour on the runtime system with
- SMP support (N equals the number of scheduler threads):
+ Multiple, thread specific instances of the allocator.
+ This option will only have any effect on the runtime system
+ with SMP support. Default behaviour on the runtime system with
+ SMP support:
- temp_alloc
- - N + 1 instances.
ll_alloc
- 1 instance.
Other allocators
- - N instances when N is less than or equal to
- 16. 16 instances when N is greater than
- 16.
+ - NoSchedulers+1 instances. Each scheduler will use
+ a lock-free instance of its own and other threads will use
+ a common instance.
- temp_alloc will always use N + 1 instances when
- this option has been enabled regardless of the amount passed.
- Other allocators will use the same amount of instances as the
- amount passed as long as it isn't greater than N.
+ It was previously (before ERTS version 5.9) possible to configure
+ a smaller amount of thread specific instances than schedulers.
+ This is, however, not possible any more.
Currently the following flags are available for configuration of
--
cgit v1.2.3