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] drm/scheduler: use hw_rq_count for load calculation
Date: Fri, 19 Oct 2018 00:37:46 +0900	[thread overview]
Message-ID: <20181018153746.25733-1-nayan26deshmukh@gmail.com> (raw)

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.

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

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 3e22a54a99c2..4d18497d6ecf 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -130,6 +130,12 @@ drm_sched_entity_get_free_sched(struct drm_sched_entity *entity)
 	int i;
 
 	for (i = 0; i < entity->num_rq_list; ++i) {
+		if (atomic_read(&entity->rq_list[i]->sched->hw_rq_count) <
+			entity->rq_list[i]->sched->hw_submission_limit) {
+			rq = entity->rq_list[i];
+			break;
+		}
+
 		num_jobs = atomic_read(&entity->rq_list[i]->sched->num_jobs);
 		if (num_jobs < min_jobs) {
 			min_jobs = num_jobs;
@@ -470,6 +476,14 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
 	if (spsc_queue_count(&entity->job_queue) || entity->num_rq_list <= 1)
 		return;
 
+	/*
+	 * We don't need to shift entity if the hardware
+	 * queue of current scheduler is empty
+	 */
+	if (atomic_read(&entity->rq->sched->hw_rq_count) <
+		entity->rq->sched->hw_submission_limit)
+		return;
+
 	fence = READ_ONCE(entity->last_scheduled);
 	if (fence && !dma_fence_is_signaled(fence))
 		return;
-- 
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-18 15:38 UTC|newest]

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