*/
        local_bh_disable();
        rcu_read_lock(); /* RCU serialisation for set-wedged protection */
-       if (engine->schedule)
-               engine->schedule(request, &request->gem_context->sched);
+       if (engine->schedule) {
+               struct i915_sched_attr attr = request->gem_context->sched;
+
+               /*
+                * Boost priorities to new clients (new request flows).
+                *
+                * Allow interactive/synchronous clients to jump ahead of
+                * the bulk clients. (FQ_CODEL)
+                */
+               if (!prev || i915_request_completed(prev))
+                       attr.priority |= I915_PRIORITY_NEWCLIENT;
+
+               engine->schedule(request, &attr);
+       }
        rcu_read_unlock();
        i915_sw_fence_commit(&request->submit);
        local_bh_enable(); /* Kick the execlists tasklet if just scheduled */
 
        I915_PRIORITY_INVALID = INT_MIN
 };
 
-#define I915_USER_PRIORITY_SHIFT 0
+#define I915_USER_PRIORITY_SHIFT 1
 #define I915_USER_PRIORITY(x) ((x) << I915_USER_PRIORITY_SHIFT)
 
 #define I915_PRIORITY_COUNT BIT(I915_USER_PRIORITY_SHIFT)
 #define I915_PRIORITY_MASK (I915_PRIORITY_COUNT - 1)
 
+#define I915_PRIORITY_NEWCLIENT        ((u8)BIT(0))
+
 struct i915_sched_attr {
        /**
         * @priority: execution and service priority
 
 
 static void __unwind_incomplete_requests(struct intel_engine_cs *engine)
 {
-       struct i915_request *rq, *rn;
+       struct i915_request *rq, *rn, *active = NULL;
        struct list_head *uninitialized_var(pl);
-       int last_prio = I915_PRIORITY_INVALID;
+       int prio = I915_PRIORITY_INVALID | I915_PRIORITY_NEWCLIENT;
 
        lockdep_assert_held(&engine->timeline.lock);
 
                                         &engine->timeline.requests,
                                         link) {
                if (i915_request_completed(rq))
-                       return;
+                       break;
 
                __i915_request_unsubmit(rq);
                unwind_wa_tail(rq);
 
                GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
-               if (rq_prio(rq) != last_prio) {
-                       last_prio = rq_prio(rq);
-                       pl = lookup_priolist(engine, last_prio);
+               if (rq_prio(rq) != prio) {
+                       prio = rq_prio(rq);
+                       pl = lookup_priolist(engine, prio);
                }
                GEM_BUG_ON(RB_EMPTY_ROOT(&engine->execlists.queue.rb_root));
 
                list_add(&rq->sched.link, pl);
+
+               active = rq;
+       }
+
+       /*
+        * The active request is now effectively the start of a new client
+        * stream, so give it the equivalent small priority bump to prevent
+        * it being gazumped a second time by another peer.
+        */
+       if (!(prio & I915_PRIORITY_NEWCLIENT)) {
+               prio |= I915_PRIORITY_NEWCLIENT;
+               list_move_tail(&active->sched.link,
+                              lookup_priolist(engine, prio));
        }
 }