diff mbox

[4/6] drm/i915: Treat an error from i915_vma_instance() as unlikely

Message ID 20170119192659.31789-4-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Jan. 19, 2017, 7:26 p.m. UTC
When pinning into the global GTT, an error from creating the VMA is
unlikely, so mark it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joonas Lahtinen Jan. 20, 2017, 12:34 p.m. UTC | #1
On to, 2017-01-19 at 19:26 +0000, Chris Wilson wrote:
> When pinning into the global GTT, an error from creating the VMA is
> unlikely, so mark it so.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

<SNIP>
 
>  	vma = i915_vma_instance(obj, vm, view);
> -	if (IS_ERR(vma))
> +	if (unlikely(IS_ERR(vma)))
>  		return vma;

I bet we have many spots similar to this, any ideas how we could get
some good code coverage testing data from the selftests? I think we
only now optimize when it appears during debugging some specific
problem.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fdb6e0ece18c..ae13450fcbe2 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3680,7 +3680,7 @@  i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
 	lockdep_assert_held(&obj->base.dev->struct_mutex);
 
 	vma = i915_vma_instance(obj, vm, view);
-	if (IS_ERR(vma))
+	if (unlikely(IS_ERR(vma)))
 		return vma;
 
 	if (i915_vma_misplaced(vma, size, alignment, flags)) {