Commit 8dc9fbbf authored by Nayan Deshmukh's avatar Nayan Deshmukh Committed by Alex Deucher

drm/scheduler: add a pointer to scheduler in the rq

This patch is in preparation for a better load balancing in
scheduler. It allows us to associate entities with the
run queues instead of binding them to a scheduler.
Signed-off-by: default avatarNayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b7d85e1d
...@@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); ...@@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);
* *
* Initializes a scheduler runqueue. * Initializes a scheduler runqueue.
*/ */
static void drm_sched_rq_init(struct drm_sched_rq *rq) static void drm_sched_rq_init(struct drm_gpu_scheduler *sched,
struct drm_sched_rq *rq)
{ {
spin_lock_init(&rq->lock); spin_lock_init(&rq->lock);
INIT_LIST_HEAD(&rq->entities); INIT_LIST_HEAD(&rq->entities);
rq->current_entity = NULL; rq->current_entity = NULL;
rq->sched = sched;
} }
/** /**
...@@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, ...@@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
sched->timeout = timeout; sched->timeout = timeout;
sched->hang_limit = hang_limit; sched->hang_limit = hang_limit;
for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++) for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++)
drm_sched_rq_init(&sched->sched_rq[i]); drm_sched_rq_init(sched, &sched->sched_rq[i]);
init_waitqueue_head(&sched->wake_up_worker); init_waitqueue_head(&sched->wake_up_worker);
init_waitqueue_head(&sched->job_scheduled); init_waitqueue_head(&sched->job_scheduled);
......
...@@ -93,6 +93,7 @@ struct drm_sched_entity { ...@@ -93,6 +93,7 @@ struct drm_sched_entity {
* struct drm_sched_rq - queue of entities to be scheduled. * struct drm_sched_rq - queue of entities to be scheduled.
* *
* @lock: to modify the entities list. * @lock: to modify the entities list.
* @sched: the scheduler to which this rq belongs to.
* @entities: list of the entities to be scheduled. * @entities: list of the entities to be scheduled.
* @current_entity: the entity which is to be scheduled. * @current_entity: the entity which is to be scheduled.
* *
...@@ -102,6 +103,7 @@ struct drm_sched_entity { ...@@ -102,6 +103,7 @@ struct drm_sched_entity {
*/ */
struct drm_sched_rq { struct drm_sched_rq {
spinlock_t lock; spinlock_t lock;
struct drm_gpu_scheduler *sched;
struct list_head entities; struct list_head entities;
struct drm_sched_entity *current_entity; struct drm_sched_entity *current_entity;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment