From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: "Sandeep Patil" <sspatil@google.com>,
dri-devel@lists.freedesktop.org,
"Ezequiel Garcia" <ezequiel@collabora.com>,
"Robin Murphy" <robin.murphy@arm.com>,
"James Jones" <jajones@nvidia.com>,
"Liam Mark" <lmark@codeaurora.org>,
"Laura Abbott" <labbott@kernel.org>,
"Hridya Valsaraju" <hridya@google.com>,
"Ørjan Eide" <orjan.eide@arm.com>,
"Suren Baghdasaryan" <surenb@google.com>,
linux-media@vger.kernel.org
Subject: [PATCH v2 0/6] dma-buf: Performance improvements for system heap
Date: Thu, 1 Oct 2020 01:21:45 +0000 [thread overview]
Message-ID: <20201001012151.21149-1-john.stultz@linaro.org> (raw)
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:
https://git.linaro.org/people/john.stultz/android-dev.git/commit/?h=dev/dma-buf-heap-perf&id=24c723fb41c7a9cb5cf9b2412722866cba3a1417
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.
https://docs.google.com/spreadsheets/d/1-1C8ZQpmkl_0DISkI6z4xelE08MlNAN7oEu34AnO4Ao/edit#gid=0
Finally, a port of a patch that Ørjan Eide implemented for ION
that avoids calling sync on attachments that don't have a
mapping.
Feedback on these would be great!
thanks
-john
New in v2:
* Fix unused return value and locking issue Reported-by:
kernel test robot <lkp@intel.com>
Julia Lawall <julia.lawall@inria.fr>
* Make system_heap_buf_ops static Reported-by:
kernel test robot <lkp@intel.com>
* Make cma_heap_buf_ops static suggested by
kernel test robot <lkp@intel.com>
* Fix uninitialized return in cma Reported-by:
kernel test robot <lkp@intel.com>
* Minor cleanups
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
John Stultz (6):
dma-buf: system_heap: Rework system heap to use sgtables instead of
pagelists
dma-buf: heaps: Move heap-helper logic into the cma_heap
implementation
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
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2020-10-01 1:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 1:21 John Stultz [this message]
2020-10-01 1:21 ` [PATCH v2 1/6] dma-buf: system_heap: Rework system heap to use sgtables instead of pagelists John Stultz
2020-10-01 1:21 ` [PATCH v2 2/6] dma-buf: heaps: Move heap-helper logic into the cma_heap implementation John Stultz
2020-10-01 1:21 ` [PATCH v2 3/6] dma-buf: heaps: Remove heap-helpers code John Stultz
2020-10-01 1:21 ` [PATCH v2 4/6] dma-buf: system_heap: Allocate higher order pages if available John Stultz
2020-10-01 1:21 ` [PATCH v2 5/6] dma-buf: system_heap: Add pagepool support to system heap John Stultz
2020-10-01 1:21 ` [PATCH v2 6/6] dma-buf: heaps: Skip sync if not mapped John Stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201001012151.21149-1-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ezequiel@collabora.com \
--cc=hridya@google.com \
--cc=jajones@nvidia.com \
--cc=labbott@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lmark@codeaurora.org \
--cc=orjan.eide@arm.com \
--cc=robin.murphy@arm.com \
--cc=sspatil@google.com \
--cc=surenb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox