[Intel-gfx] [PATCH v5] drm: Improve drm_mm search (and fix topdown allocation) with rbtrees

Daniel Vetter daniel at ffwll.ch
Fri Feb 3 10:11:15 UTC 2017


On Fri, Feb 03, 2017 at 10:49:22AM +0100, Lucas Stach wrote:
> Am Donnerstag, den 02.02.2017, 21:04 +0000 schrieb Chris Wilson:
> > The drm_mm range manager claimed to support top-down insertion, but it
> > was neither searching for the top-most hole that could fit the
> > allocation request nor fitting the request to the hole correctly.
> > 
> > In order to search the range efficiently, we create a secondary index
> > for the holes using either their size or their address. This index
> > allows us to find the smallest hole or the hole at the bottom or top of
> > the range efficiently, whilst keeping the hole stack to rapidly service
> > evictions.
> > 
> > v2: Search for holes both high and low. Rename flags to mode.
> > v3: Discover rb_entry_safe() and use it!
> > v4: Kerneldoc for enum drm_mm_insert_mode.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: Alex Deucher <alexander.deucher at amd.com>
> > Cc: "Christian König" <christian.koenig at amd.com>
> > Cc: David Airlie <airlied at linux.ie>
> > Cc: Russell King <rmk+kernel at armlinux.org.uk>
> > Cc: Daniel Vetter <daniel.vetter at intel.com>
> > Cc: Jani Nikula <jani.nikula at linux.intel.com>
> > Cc: Sean Paul <seanpaul at chromium.org>
> > Cc: Lucas Stach <l.stach at pengutronix.de>
> > Cc: Christian Gmeiner <christian.gmeiner at gmail.com>
> > Cc: Rob Clark <robdclark at gmail.com>
> > Cc: Thierry Reding <thierry.reding at gmail.com>
> > Cc: Stephen Warren <swarren at wwwdotorg.org>
> > Cc: Alexandre Courbot <gnurou at gmail.com>
> > Cc: Eric Anholt <eric at anholt.net>
> > Cc: Sinclair Yeh <syeh at vmware.com>
> > Cc: Thomas Hellstrom <thellstrom at vmware.com>
> > Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> > Reviewed-by: Sinclair Yeh <syeh at vmware.com> # vmwgfx
> 
> I can't really comment on the other parts of this patch (way too much
> code that I'm only vaguely familiar with), but the etnaviv part of the
> change looks fine.
> 
> Reviewed-by: Lucas Stach <l.stach at pengutronix.de> #etnaviv

Applied to drm-misc, thanks for patch&reviews.
-Daniel

> > ---
> > 
> > v5: Rebase onto etnaviv pull for 4.11 -- no intentional changes from v4.
> > 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c  |  16 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c |  20 +-
> >  drivers/gpu/drm/armada/armada_gem.c          |   4 +-
> >  drivers/gpu/drm/drm_mm.c                     | 488 +++++++++++++++------------
> >  drivers/gpu/drm/drm_vma_manager.c            |   3 +-
> >  drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |  11 +-
> >  drivers/gpu/drm/i915/i915_gem.c              |  10 +-
> >  drivers/gpu/drm/i915/i915_gem_evict.c        |   9 +-
> >  drivers/gpu/drm/i915/i915_gem_execbuffer.c   |   5 +-
> >  drivers/gpu/drm/i915/i915_gem_gtt.c          |  39 +--
> >  drivers/gpu/drm/i915/i915_gem_stolen.c       |   6 +-
> >  drivers/gpu/drm/msm/msm_gem.c                |   3 +-
> >  drivers/gpu/drm/msm/msm_gem_vma.c            |   3 +-
> >  drivers/gpu/drm/selftests/test-drm_mm.c      |  58 ++--
> >  drivers/gpu/drm/sis/sis_mm.c                 |   6 +-
> >  drivers/gpu/drm/tegra/gem.c                  |   4 +-
> >  drivers/gpu/drm/ttm/ttm_bo_manager.c         |  18 +-
> >  drivers/gpu/drm/vc4/vc4_crtc.c               |   2 +-
> >  drivers/gpu/drm/vc4/vc4_hvs.c                |   3 +-
> >  drivers/gpu/drm/vc4/vc4_plane.c              |   6 +-
> >  drivers/gpu/drm/via/via_mm.c                 |   4 +-
> >  drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c       |  10 +-
> >  include/drm/drm_mm.h                         | 184 +++++-----
> >  23 files changed, 470 insertions(+), 442 deletions(-)
> [...]
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list