From: Tvrtko Ursulin <tvrtko.ursu...@intel.com>

Inherit submitter nice at point of request submission to account for
long running processes getting either externally or self re-niced.

Nice value will only apply to requests which originate from user
contexts and have default context priority.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
---
 drivers/gpu/drm/i915/i915_request.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c 
b/drivers/gpu/drm/i915/i915_request.c
index 960bfd517ff7..a777f14e4b87 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -1811,8 +1811,11 @@ void i915_request_add(struct i915_request *rq)
        /* XXX placeholder for selftests */
        rcu_read_lock();
        ctx = rcu_dereference(rq->context->gem_context);
-       if (ctx)
+       if (ctx) {
                attr = ctx->sched;
+               if (attr.priority == I915_CONTEXT_DEFAULT_PRIORITY)
+                       attr.nice = task_nice(current);
+       }
        rcu_read_unlock();
 
        __i915_request_queue(rq, &attr);
-- 
2.32.0

Reply via email to