All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nayan Deshmukh <nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Nayan Deshmukh
	<nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org,
	alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	christian.koenig-5C7GfCeVMHo@public.gmane.org,
	l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Subject: [PATCH 2/4] drm/scheduler: add counter for total jobs in scheduler
Date: Wed,  1 Aug 2018 13:50:00 +0530	[thread overview]
Message-ID: <20180801082002.20696-2-nayan26deshmukh@gmail.com> (raw)
In-Reply-To: <20180801082002.20696-1-nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 3 +++
 include/drm/gpu_scheduler.h               | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index a3eacc35cf98..375f6f7f6a93 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -549,6 +549,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,
 
 	trace_drm_sched_job(sched_job, entity);
 
+	atomic_inc(&entity->rq->sched->num_jobs);
 	first = spsc_queue_push(&entity->job_queue, &sched_job->queue_node);
 
 	/* first job wakes up scheduler */
@@ -836,6 +837,7 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb)
 
 	dma_fence_get(&s_fence->finished);
 	atomic_dec(&sched->hw_rq_count);
+	atomic_dec(&sched->num_jobs);
 	drm_sched_fence_finished(s_fence);
 
 	trace_drm_sched_process_job(s_fence);
@@ -953,6 +955,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
 	INIT_LIST_HEAD(&sched->ring_mirror_list);
 	spin_lock_init(&sched->job_list_lock);
 	atomic_set(&sched->hw_rq_count, 0);
+	atomic_set(&sched->num_jobs, 0);
 	atomic64_set(&sched->job_id_count, 0);
 
 	/* Each scheduler will run on a seperate kernel thread */
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index a60896222a3e..89881ce974a5 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -260,6 +260,7 @@ struct drm_sched_backend_ops {
  * @job_list_lock: lock to protect the ring_mirror_list.
  * @hang_limit: once the hangs by a job crosses this limit then it is marked
  *              guilty and it will be considered for scheduling further.
+ * @num_jobs: the number of jobs in queue in the scheduler
  *
  * One scheduler is implemented for each hardware ring.
  */
@@ -277,6 +278,7 @@ struct drm_gpu_scheduler {
 	struct list_head		ring_mirror_list;
 	spinlock_t			job_list_lock;
 	int				hang_limit;
+	atomic_t                        num_jobs;
 };
 
 int drm_sched_init(struct drm_gpu_scheduler *sched,
-- 
2.14.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-08-01  8:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01  8:19 [PATCH 1/4] drm/scheduler: add a list of run queues to the entity Nayan Deshmukh
2018-08-01  8:20 ` [PATCH 4/4] drm/scheduler: move idle entities to scheduler with less load v2 Nayan Deshmukh
     [not found] ` <20180801082002.20696-1-nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-01  8:20   ` Nayan Deshmukh [this message]
     [not found]     ` <20180801082002.20696-2-nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-01 13:15       ` [PATCH 2/4] drm/scheduler: add counter for total jobs in scheduler Huang Rui
2018-08-01 13:06         ` Christian König
2018-08-02  2:57           ` Huang Rui
2018-08-02  6:11             ` Nayan Deshmukh
2018-08-01  8:20   ` [PATCH 3/4] drm/scheduler: add new function to get least loaded sched v2 Nayan Deshmukh
2018-08-01 15:35     ` Andrey Grodzovsky
2018-08-01 16:06       ` Nayan Deshmukh
     [not found]         ` <CAFd4ddx8D2iKquRu4YVh1gnRMpLFgWf3CBPdk5SD-nJ8dNXEPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-01 17:51           ` Andrey Grodzovsky
2018-08-02  2:51           ` Zhou, David(ChunMing)
2018-08-02  6:01             ` Nayan Deshmukh
     [not found]               ` <CAFd4ddyf=EhJ7pmzq3sEGa6U1sQ7Ga7fUH+sW+VKeBxJABjnKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-02  6:42                 ` zhoucm1
2018-08-01  9:35   ` [PATCH 1/4] drm/scheduler: add a list of run queues to the entity Christian König
  -- strict thread matches above, loose matches on Subject: below --
2018-07-31 10:37 [PATCH 0/4] drm/scheduler: add dynamic balancing Nayan Deshmukh
     [not found] ` <20180731103736.7813-1-nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-07-31 10:37   ` [PATCH 2/4] drm/scheduler: add counter for total jobs in scheduler Nayan Deshmukh

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=20180801082002.20696-2-nayan26deshmukh@gmail.com \
    --to=nayan26deshmukh-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org \
    --cc=l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.