v6: memtank introduction 17/23217/7
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Thu, 27 Jun 2019 18:28:26 +0000 (19:28 +0100)
committerKonstantin Ananyev <konstantin.ananyev@intel.com>
Tue, 31 Dec 2019 11:42:11 +0000 (11:42 +0000)
commit703faabf2d44d245fe1dd0b75f1736bf6114a557
tree1695eb924b9ff8236e0eabb084ab6b969c162d88
parent0ee0943991b7d2cb43c63c76ba59035cacbc1b91
v6: memtank introduction

For analogy with mempool, named this structure memtank.
Same a s mempool it allows to alloc/free objects of fixed size
in a lightweight manner (not as lightweight as mempool,
but hopefully close enough).
The whole idea is that alloc/free is used at fast-path and don't
allocate/free more than *min_free* objects at one call.
So for majority of cases our fast-path alloc/free should be lightweight
(LIFO enqueue/dequeue operations).
Also user will need to call grow/shrink periodically
(ideally from the slow-path) to make sure there is enough
free objects in the tank.
Internally it is just a simple LIFO for up to *max_free* objects plus
a list of memory buffers (memchunk) from where these objects were
allocated.

v1 -> v2
 - Added UT
 - Fixed few bugs

v2 -> v3
 - extend UT with more parameters

v3 -> v4
 - add object alignement as parameter for memtank_create
 - extend UT with more parameters
 - added memtank dump routine

v4 -> v5
 - fixed few bugs inside memtank lib
 - extend UT with:
   - new test case
   - new command-line options: '-s <obj_size>', '-m <mem_func>'

v5 -> v6
 - extend memtank dump to collect/display extra information
 - make memtank dump routine MT safe
 - add memtank sanity check function
 - add proper comments for pubic API

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Change-Id: I8939772577f5d9e293088eaa9a9fe316c3fe8f87
lib/Makefile
lib/libtle_memtank/Makefile [new file with mode: 0644]
lib/libtle_memtank/memtank.c [new file with mode: 0644]
lib/libtle_memtank/memtank.h [new file with mode: 0644]
lib/libtle_memtank/misc.c [new file with mode: 0644]
lib/libtle_memtank/tle_memtank.h [new file with mode: 0644]
lib/libtle_memtank/tle_memtank_pub.h [new file with mode: 0644]
test/Makefile
test/memtank/Makefile [new file with mode: 0644]
test/memtank/test_memtank.c [new file with mode: 0644]