[Intel-gfx] [PATCH v2] drm/i915: Optimistically spin for the request completion

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 11 14:18:19 PDT 2015


On Wed, Mar 11, 2015 at 03:29:19PM +0000, Chris Wilson wrote:
> +	while (!need_resched()) {
> +		if (i915_gem_request_completed(req, true)) {
> +			ret = 0;
> +			goto out;
> +		}
> +
> +		if (timeout && time_after_eq(jiffies, timeout))
> +			break;
> +
> +		cpu_relax_lowlatency();
> +	}

Hmm. This unfortunately doesn't quite work the same as the optimistic
mutex spinner. The difference being that the scheduler knows that two
processes are contending for the mutex, but it doesn't know about the
contention between the thread and the GPU. The result is that unless
there is other activity on the system we simply degrade into a busy-spin
until the GPU is finished, rather than what I intended as spin for the
next ~10ms and then fallback to the interrupt.

Arguably busy-spinning on an idle system isn't totally evil, but it
certainly is likely to come at a power cost. On the other hand, spinning
is relatively rare outside of benchmarks. Rare enough to be useful?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list