[API-NEXT,PATCHv8,0/6] small memory amount allocator for drv shm

Message ID 1484677083-12831-1-git-send-email-christophe.milard@linaro.org
Headers show
  • small memory amount allocator for drv shm
Related show


Christophe Milard Jan. 17, 2017, 6:17 p.m.
Since V7:
 -doxygen fix (Thanks Maxim!)

Since V6:

Since V5:
 -title fix (Yi)
 -flag name fix (Christophe)

Since V4:
 -fix for clang

Since V3:
 -copyright year changed

Since V2:
 -comment and doxygen fixes (Petri)

Since V1:
 -Common south pool (for all drivers) suppressed. (Petri)
 -function to create and destroy the pools exposed to the interface,
  so that each user create his own pools (Petri)
 -support for fixed size allocator added (Petri, Bill)
 -Creation parameter now includes the min-alloc/max_alloc (Petri)
 -Pool creation parameter passed as struct (Petri)

This patch series aims at giving the ability for units using the ODP
drv (south) interface to allocate small unit of memory (hence going lower
than the page size, which is the lower limit for odp_drvshm_reserve()).
South interface users can create and destroy pool of memory using
odpdrv_shm_pool_create() odpdrv_shm_pool_destroy().
The interface also provides two functions: odpdrv_shm_pool_alloc()
and odpdrv_shm_pool_free() whose usage is very similar to
malloc/free, but which also guarantee address uniqueness amoung all
ODP threads).
Internally, for the linux-gen implementation, this is implemented thanks
to a buddy and slab allocator handling the preallocated memory.
Enumerators typically will need this to contruct the list of enumerated
devices. ODP will also need it for building list of things such as
enumerators, devio, drivers...
(PS:I guess this concept will be needed as well on the north (API) interface
when we start looking into having things working "in process mode")

Christophe Milard (6):
  linux-gen: _ishm: adding buddy and slab allocation
  drv: adding odpdrv_shm_pool functions
  linux-gen: drv: shm: adding pool allocator
  test: drv: shm: adding basic buddy allocation tests
  test: drv: shm: adding basic fixed size allocation tests
  test: drv: shm: adding buddy allocation stress tests

 include/odp/drv/spec/shm.h                         |  99 +++
 platform/linux-generic/Makefile.am                 |   2 +
 platform/linux-generic/_ishm.c                     |  14 +-
 platform/linux-generic/_ishmpool.c                 | 811 +++++++++++++++++++++
 platform/linux-generic/drv_shm.c                   |  44 ++
 .../linux-generic/include/_ishmpool_internal.h     |  56 ++
 .../linux-generic/include/odp/drv/plat/shm_types.h |   3 +
 .../common_plat/validation/drv/drvshmem/drvshmem.c | 355 +++++++++
 .../common_plat/validation/drv/drvshmem/drvshmem.h |   3 +
 9 files changed, 1386 insertions(+), 1 deletion(-)
 create mode 100644 platform/linux-generic/_ishmpool.c
 create mode 100644 platform/linux-generic/include/_ishmpool_internal.h