]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Limit searching for PIN_HIGH
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 May 2018 08:21:30 +0000 (09:21 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 May 2018 14:04:35 +0000 (15:04 +0100)
commitd4521fe3e56d425599d3792012531c40be10e62f
treec943ea7c204223e6f287e82d329acb5bc2e43d24
parent4ae636c735a8081e98b042307bb83c0325a9182f
drm/i915: Limit searching for PIN_HIGH

To no surprise (since we've flip-flopped over the use of PIN_HIGH a few
times), doing a search by address over a pathologically fragmented
address space is exceeding slow. To protect ourselves from nearly
unbounded latency (think searching a million holes while under
struct_mutex), limit the search for the highest available hole and
fallback to best-fit if it fails.

In the pathologically fragmented case, such as igt/gem_ctx_thrash, the
effect is dramatic, bringing the runtime down from hours to seconds
(depending on how many other slow searches you hit, e.g. alloc_iova()
and alloc_vmap_area() both degrade to a slow rbtree walk after their
small cache is exhausted). For the real world, the number of search
steps is unlikely to be significant as we should only need to search
once per new context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180521082131.13744-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_gtt.c