[PATCH 101/190] drm/i915: Only retire if necessary when creating a userptr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We only want to retire requests if we have an existing object that
conflicts with the fresh userptr range in order to avoid unnecessary
work during creation of every userptr.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index a90392246471..2f922392bd10 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -187,17 +187,23 @@ i915_mmu_notifier_add(struct drm_device *dev,
 	 * using an interrupt timer is likely to get stuck in an EINTR loop).
 	 */
 	mutex_lock(&dev->struct_mutex);
-
-	/* Make sure we drop the final active reference (and thereby
-	 * remove the objects from the interval tree) before we do
-	 * the check for overlapping objects.
-	 */
-	i915_gem_retire_requests(dev);
-
 	spin_lock(&mn->lock);
 	it = interval_tree_iter_first(&mn->objects,
 				      mo->it.start, mo->it.last);
 	if (it) {
+		spin_unlock(&mn->lock);
+
+		/* Make sure we drop the final active reference (and thereby
+		 * remove the objects from the interval tree) before we do
+		 * the check for overlapping objects.
+		 */
+		i915_gem_retire_requests(dev);
+
+		spin_lock(&mn->lock);
+		it = interval_tree_iter_first(&mn->objects,
+					      mo->it.start, mo->it.last);
+	}
+	if (it) {
 		struct drm_i915_gem_object *obj;
 
 		/* We only need to check the first object in the range as it
-- 
2.7.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux