[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v2 0/6] dma-buf: Performance improvements for system heap
Hey All,
So this patch series contains a series of performance
optimizations to the dma-buf system heap.

Unfortunately, in working these up, I realized the heap-helpers
infrastructure we tried to add to miniimize code duplication is
not as generic as we intended. For some heaps it makes sense to
deal with page lists, for other heaps it makes more sense to
track things with sgtables.

So this series reworks the system heap to use sgtables, and then
consolidates the pagelist method from the heap-helpers into the
CMA heap. After which the heap-helpers logic is removed (as it
is unused). I'd still like to find a better way to avoid some of
the logic duplication in implementing the entire dma_buf_ops
handlers per heap. But unfortunately that code is tied somewhat
to how the buffer's memory is tracked.

After this, the series introduces two optimizations to the the
system heap, utilizing large order pages, and adding a page-pool
(maybe abusing the pagepool logic from the network code, but it
seems silly to reimplement it).

I implemented a simple allocation microbenchmark to compare
dmabuf heaps vs ion:

With these changes, the allocation path is *much* improved,
performing better then ION (though to be fair, the repeated
allocating and freeing of the same size buffer is the ideal
case for the pagepool logic, so don't read too much into it).

I charted some datapoints from the microbenchmark with each
of the patches should folks be interested.

Finally, a port of a patch that Ørjan Eide implemented for ION
that avoids calling sync on attachments that don't have a

Feedback on these would be great!


New in v2:
* Fix unused return value and locking issue Reported-by:
kernel test robot <>
Julia Lawall <>
* Make system_heap_buf_ops static Reported-by:
kernel test robot <>
* Make cma_heap_buf_ops static suggested by
kernel test robot <>
* Fix uninitialized return in cma Reported-by:
kernel test robot <>
* Minor cleanups

Cc: Sumit Semwal <>
Cc: Liam Mark <>
Cc: Laura Abbott <>
Cc: Brian Starkey <>
Cc: Hridya Valsaraju <>
Cc: Suren Baghdasaryan <>
Cc: Sandeep Patil <>
Cc: Ørjan Eide <>
Cc: Robin Murphy <>
Cc: Ezequiel Garcia <>
Cc: Simon Ser <>
Cc: James Jones <>

John Stultz (6):
dma-buf: system_heap: Rework system heap to use sgtables instead of
dma-buf: heaps: Move heap-helper logic into the cma_heap
dma-buf: heaps: Remove heap-helpers code
dma-buf: system_heap: Allocate higher order pages if available
dma-buf: system_heap: Add pagepool support to system heap
dma-buf: heaps: Skip sync if not mapped

drivers/dma-buf/heaps/Kconfig | 1 +
drivers/dma-buf/heaps/Makefile | 1 -
drivers/dma-buf/heaps/cma_heap.c | 328 ++++++++++++++++----
drivers/dma-buf/heaps/heap-helpers.c | 271 -----------------
drivers/dma-buf/heaps/heap-helpers.h | 53 ----
drivers/dma-buf/heaps/system_heap.c | 427 ++++++++++++++++++++++++---
6 files changed, 659 insertions(+), 422 deletions(-)
delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c
delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h


 \ /
  Last update: 2020-10-01 03:22    [W:0.055 / U:27.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site