dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Nayan Deshmukh <nayan26deshmukh@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Nayan Deshmukh <nayan26deshmukh@gmail.com>, christian.koenig@amd.com
Subject: [PATCH v2] drm/scheduler: use hw_rq_count for load calculation
Date: Sun, 28 Oct 2018 18:59:25 +0900	[thread overview]
Message-ID: <20181028095925.20389-1-nayan26deshmukh@gmail.com> (raw)
In-Reply-To: <CAFd4ddyZu=Brpsu-9RbT3Tgev5hWq+-xKOR_phBVn-nHJ_d9Pw@mail.gmail.com>

If the hardware queue for a scheduler is empty then we don't
need to the shift the entities from their current scheduler
as they are not getting scheduled because of some dependency.

v2: to calculate the least loaded scheduler we only use hw_rq_count
when the number of jobs in their run queue are same

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
---
 drivers/gpu/drm/scheduler/sched_entity.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 3e22a54a99c2..cfe48df6621d 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -125,15 +125,21 @@ bool drm_sched_entity_is_ready(struct drm_sched_entity *entity)
 static struct drm_sched_rq *
 drm_sched_entity_get_free_sched(struct drm_sched_entity *entity)
 {
-	struct drm_sched_rq *rq = NULL;
+	struct drm_sched_rq *rq = NULL, *curr_rq = NULL;
 	unsigned int min_jobs = UINT_MAX, num_jobs;
 	int i;
 
 	for (i = 0; i < entity->num_rq_list; ++i) {
-		num_jobs = atomic_read(&entity->rq_list[i]->sched->num_jobs);
+		curr_rq = entity->rq_list[i];
+		num_jobs = atomic_read(&curr_rq->sched->num_jobs);
 		if (num_jobs < min_jobs) {
 			min_jobs = num_jobs;
-			rq = entity->rq_list[i];
+			rq = curr_rq;
+		} else if (num_jobs == min_jobs) {
+			if (atomic_read(&curr_rq->sched->hw_rq_count) <
+				atomic_read(&rq->sched->hw_rq_count)) {
+				rq = curr_rq;
+			}
 		}
 	}
 
-- 
2.14.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-10-28 10:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 15:37 [PATCH] drm/scheduler: use hw_rq_count for load calculation Nayan Deshmukh
2018-10-22 12:46 ` Koenig, Christian
2018-10-23 14:52   ` Nayan Deshmukh
2018-10-28  9:59     ` Nayan Deshmukh [this message]
2018-11-07  8:09       ` [PATCH v2] " Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181028095925.20389-1-nayan26deshmukh@gmail.com \
    --to=nayan26deshmukh@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).