[PATCH 093/131] drm/i915: Break out of an eviction loop if a signal is pending

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 6 07:37:00 UTC 2016


This is a delicate compromise between blocking userspace signals for too
long and in trying to avoid having to restart an expensive operation. To
whit, if we find ourselves without a candidate for eviction, i.e. the
GTT is so fragmented that we need to unbind everything, check for a
pending signal first and bail. The second related goal here is to prevent
getting trapped inside the kernel almost indefinitely trying to handle a
large number of insertions into the GTT.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index a28b3b0b3239..4ac88fd08953 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -156,6 +156,11 @@ search_again:
 		return intel_has_pending_fb_unpin(vm->dev) ? -EAGAIN : -ENOSPC;
 	}
 
+	/* This is quite time consuming with large GTT */
+	cond_resched();
+	if (signal_pending(current))
+		return -ERESTARTSYS;
+
 	/* Not everything in the GGTT is tracked via vma (otherwise we
 	 * could evict as required with minimal stalling) so we are forced
 	 * to idle the GPU and explicitly retire outstanding requests in
-- 
2.8.1



More information about the Intel-gfx-trybot mailing list