[dpdk-dev] [PATCH v2 0/7] dynamic memzone

Sergio Gonzalez Monroy sergio.gonzalez.monroy at intel.com
Sat Jun 6 12:32:05 CEST 2015


Current implemetation allows reserving/creating memzones but not the opposite
(unreserve/free). This affects mempools and other memzone based objects.

>From my point of view, implementing free functionality for memzones would look
like malloc over memsegs.
Thus, this approach moves malloc inside eal (which in turn removes a circular
dependency), where malloc heaps are composed of memsegs.
We keep both malloc and memzone APIs as they are, but memzones allocate its
memory by calling malloc_heap_alloc.
Some extra functionality is required in malloc to allow for boundary constrained
memory requests.
In summary, currently malloc is based on memzones, and with this approach
memzones are based on malloc.

v2:
 - New rte_memzone_free
 - Support memzone len = 0
 - Add all available memsegs to malloc heap at init
 - Update memzone/malloc unit tests

TODOs:
 - checkpatch: current malloc code gives plenty of errors

Sergio Gonzalez Monroy (7):
  eal: move librte_malloc to eal/common
  eal: memzone allocated by malloc
  app/test: update malloc/memzone unit tests
  config: remove CONFIG_RTE_MALLOC_MEMZONE_SIZE
  eal: remove setup of free_memseg in ivshmem
  eal: new rte_memzone_free
  app/test: update unit test with rte_memzone_free

 app/test/test_malloc.c                            |  86 -----
 app/test/test_memzone.c                           | 439 +++-------------------
 config/common_bsdapp                              |   8 +-
 config/common_linuxapp                            |   8 +-
 drivers/net/af_packet/Makefile                    |   1 -
 drivers/net/bonding/Makefile                      |   1 -
 drivers/net/e1000/Makefile                        |   2 +-
 drivers/net/enic/Makefile                         |   2 +-
 drivers/net/fm10k/Makefile                        |   2 +-
 drivers/net/i40e/Makefile                         |   2 +-
 drivers/net/ixgbe/Makefile                        |   2 +-
 drivers/net/mlx4/Makefile                         |   1 -
 drivers/net/null/Makefile                         |   1 -
 drivers/net/pcap/Makefile                         |   1 -
 drivers/net/virtio/Makefile                       |   2 +-
 drivers/net/vmxnet3/Makefile                      |   2 +-
 drivers/net/xenvirt/Makefile                      |   2 +-
 lib/Makefile                                      |   1 -
 lib/librte_acl/Makefile                           |   2 +-
 lib/librte_eal/bsdapp/eal/Makefile                |   4 +-
 lib/librte_eal/bsdapp/eal/rte_eal_version.map     |  19 +
 lib/librte_eal/common/Makefile                    |   1 +
 lib/librte_eal/common/eal_common_memzone.c        | 323 ++++++----------
 lib/librte_eal/common/include/rte_eal_memconfig.h |   4 +-
 lib/librte_eal/common/include/rte_malloc.h        | 342 +++++++++++++++++
 lib/librte_eal/common/include/rte_malloc_heap.h   |   3 +-
 lib/librte_eal/common/include/rte_memory.h        |   1 +
 lib/librte_eal/common/include/rte_memzone.h       |  11 +
 lib/librte_eal/common/malloc_elem.c               | 344 +++++++++++++++++
 lib/librte_eal/common/malloc_elem.h               | 192 ++++++++++
 lib/librte_eal/common/malloc_heap.c               | 207 ++++++++++
 lib/librte_eal/common/malloc_heap.h               |  70 ++++
 lib/librte_eal/common/rte_malloc.c                | 259 +++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile              |   4 +-
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c         |  37 +-
 lib/librte_eal/linuxapp/eal/rte_eal_version.map   |  19 +
 lib/librte_hash/Makefile                          |   2 +-
 lib/librte_lpm/Makefile                           |   2 +-
 lib/librte_malloc/Makefile                        |  52 ---
 lib/librte_malloc/malloc_elem.c                   | 320 ----------------
 lib/librte_malloc/malloc_elem.h                   | 190 ----------
 lib/librte_malloc/malloc_heap.c                   | 209 ----------
 lib/librte_malloc/malloc_heap.h                   |  70 ----
 lib/librte_malloc/rte_malloc.c                    | 260 -------------
 lib/librte_malloc/rte_malloc.h                    | 342 -----------------
 lib/librte_malloc/rte_malloc_version.map          |  19 -
 lib/librte_mempool/Makefile                       |   2 -
 lib/librte_port/Makefile                          |   1 -
 lib/librte_ring/Makefile                          |   3 +-
 lib/librte_table/Makefile                         |   1 -
 50 files changed, 1685 insertions(+), 2193 deletions(-)
 create mode 100644 lib/librte_eal/common/include/rte_malloc.h
 create mode 100644 lib/librte_eal/common/malloc_elem.c
 create mode 100644 lib/librte_eal/common/malloc_elem.h
 create mode 100644 lib/librte_eal/common/malloc_heap.c
 create mode 100644 lib/librte_eal/common/malloc_heap.h
 create mode 100644 lib/librte_eal/common/rte_malloc.c
 delete mode 100644 lib/librte_malloc/Makefile
 delete mode 100644 lib/librte_malloc/malloc_elem.c
 delete mode 100644 lib/librte_malloc/malloc_elem.h
 delete mode 100644 lib/librte_malloc/malloc_heap.c
 delete mode 100644 lib/librte_malloc/malloc_heap.h
 delete mode 100644 lib/librte_malloc/rte_malloc.c
 delete mode 100644 lib/librte_malloc/rte_malloc.h
 delete mode 100644 lib/librte_malloc/rte_malloc_version.map

-- 
1.9.3



More information about the dev mailing list