Skip to content

Commit

Permalink
drm/i915: Only defer freeing of fence callback when also using the timer
Browse files Browse the repository at this point in the history
Without an accompanying timer (for internal fences), we can free the
fence callback immediately as we do not need to employ the RCU barrier
to serialise with the timer. By avoiding the RCU delay, we can avoid the
extra mempressure under heavy inter-engine request utilisation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180115090643.26696-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Jan 15, 2018
1 parent c9ef291 commit c32164b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/gpu/drm/i915/i915_sw_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ static void dma_i915_sw_fence_wake(struct dma_fence *dma,
if (fence)
i915_sw_fence_complete(fence);

irq_work_queue(&cb->work);
if (cb->dma) {
irq_work_queue(&cb->work);
return;
}

kfree(cb);
}

static void irq_i915_sw_fence_work(struct irq_work *wrk)
Expand Down Expand Up @@ -437,10 +442,12 @@ int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
i915_sw_fence_await(fence);

cb->dma = NULL;
timer_setup(&cb->timer, timer_i915_sw_fence_wake, TIMER_IRQSAFE);
init_irq_work(&cb->work, irq_i915_sw_fence_work);
if (timeout) {
cb->dma = dma_fence_get(dma);
init_irq_work(&cb->work, irq_i915_sw_fence_work);

timer_setup(&cb->timer,
timer_i915_sw_fence_wake, TIMER_IRQSAFE);
mod_timer(&cb->timer, round_jiffies_up(jiffies + timeout));
}

Expand Down

0 comments on commit c32164b

Please sign in to comment.