[PATCH 14/56] drm/i915/gt: Rearrange clear_pd_entry() to allow a tail call

Chris Wilson chris at chris-wilson.co.uk
Sun Jan 17 15:30:54 UTC 2021


Since write_dma_entry() is now out-of-line, rearrange clear_pd_entry()
so the compiler can use a tail call optimisation.

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

diff --git a/drivers/gpu/drm/i915/gt/intel_ppgtt.c b/drivers/gpu/drm/i915/gt/intel_ppgtt.c
index 96b85a10ef33..5fb49a6fc033 100644
--- a/drivers/gpu/drm/i915/gt/intel_ppgtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ppgtt.c
@@ -103,6 +103,7 @@ __set_pd_entry(struct i915_page_directory * const pd,
 
 	atomic_inc(px_used(pd));
 	pd->entry[idx] = to;
+
 	write_dma_entry(px_base(pd), idx, encode(px_dma(to), I915_CACHE_LLC));
 }
 
@@ -113,9 +114,10 @@ clear_pd_entry(struct i915_page_directory * const pd,
 {
 	GEM_BUG_ON(atomic_read(px_used(pd)) == 0);
 
-	write_dma_entry(px_base(pd), idx, scratch->encode);
 	pd->entry[idx] = NULL;
 	atomic_dec(px_used(pd));
+
+	write_dma_entry(px_base(pd), idx, scratch->encode);
 }
 
 bool
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list