From: John Harrison Subject: Re: [PATCH 14/42] drm/i915: Use a radixtree for random access to the object's backing storage Date: Fri, 7 Oct 2016 14:36:02 +0100 Message-ID: <51dbb946-ea6d-94b3-da27-601deefd95b6@Intel.com> References: <20161007094635.28319-1-chris@chris-wilson.co.uk> <20161007094635.28319-15-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0081277410==" Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 41C526EBA1 for ; Fri, 7 Oct 2016 13:36:04 +0000 (UTC) In-Reply-To: <20161007094635.28319-15-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --===============0081277410== Content-Type: multipart/alternative; boundary="------------08781242A903CB383C136290" This is a multi-part message in MIME format. --------------08781242A903CB383C136290 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 07/10/2016 10:46, Chris Wilson wrote: > A while ago we switched from a contiguous array of pages into an sglist, > for that was both more convenient for mapping to hardware and avoided > the requirement for a vmalloc array of pages on every object. However, > certain GEM API calls (like pwrite, pread as well as performing > relocations) do desire access to individual struct pages. A quick hack > was to introduce a cache of the last access such that finding the > following page was quick - this works so long as the caller desired > sequential access. Walking backwards, or multiple callers, still hits a > slow linear search for each page. One solution is to store each > successful lookup in a radix tree. > > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/i915_drv.h | 57 ++++-------- > drivers/gpu/drm/i915/i915_gem.c | 149 ++++++++++++++++++++++++++++---- > drivers/gpu/drm/i915/i915_gem_stolen.c | 4 +- > drivers/gpu/drm/i915/i915_gem_userptr.c | 4 +- > 4 files changed, 154 insertions(+), 60 deletions(-) Am curious to know if you have any performance data to show how much of a benefit this is? Are there any real world apps that would notice or just IGT benchmarks? Reviewed-by: John Harrison --------------08781242A903CB383C136290 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit On 07/10/2016 10:46, Chris Wilson wrote:
A while ago we switched from a contiguous array of pages into an sglist,
for that was both more convenient for mapping to hardware and avoided
the requirement for a vmalloc array of pages on every object. However,
certain GEM API calls (like pwrite, pread as well as performing
relocations) do desire access to individual struct pages. A quick hack
was to introduce a cache of the last access such that finding the
following page was quick - this works so long as the caller desired
sequential access. Walking backwards, or multiple callers, still hits a
slow linear search for each page. One solution is to store each
successful lookup in a radix tree.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.h         |  57 ++++--------
 drivers/gpu/drm/i915/i915_gem.c         | 149 ++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/i915_gem_stolen.c  |   4 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c |   4 +-
 4 files changed, 154 insertions(+), 60 deletions(-)

Am curious to know if you have any performance data to show how much of a benefit this is? Are there any real world apps that would notice or just IGT benchmarks?

Reviewed-by: John Harrison <john.c.harrison@intel.com>

--------------08781242A903CB383C136290-- --===============0081277410== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0081277410==--