[Intel-gfx] [PATCH v2] drm/i915: Optimistically spin for the request completion
Daniel Vetter
daniel at ffwll.ch
Thu Mar 12 02:17:43 PDT 2015
On Wed, Mar 11, 2015 at 09:18:19PM +0000, Chris Wilson wrote:
> 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?
Maybe throw in a limit of a few useconds under the assumption that it's ok
to spin for roughly the average sleep+wakeup latency? And once spun out go
to sleep?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list