aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNayan Deshmukh <nayan26deshmukh@gmail.com>2018-07-13 05:51:13 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-07-13 15:45:58 -0400
commit8dc9fbbf274b7b2a647e06141aee70ffabf6dbc0 (patch)
tree03fb6aa2aae4331e013902b60afedc6bf18ea118
parentb7d85e1db32ea85b09f58f416da48f44285ff41f (diff)
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: Nayan Deshmukh <nayan26deshmukh@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/scheduler/gpu_scheduler.c6
-rw-r--r--include/drm/gpu_scheduler.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index 7d2560699b84..429b1328653a 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);
69 * 69 *
70 * Initializes a scheduler runqueue. 70 * Initializes a scheduler runqueue.
71 */ 71 */
72static void drm_sched_rq_init(struct drm_sched_rq *rq) 72static void drm_sched_rq_init(struct drm_gpu_scheduler *sched,
73 struct drm_sched_rq *rq)
73{ 74{
74 spin_lock_init(&rq->lock); 75 spin_lock_init(&rq->lock);
75 INIT_LIST_HEAD(&rq->entities); 76 INIT_LIST_HEAD(&rq->entities);
76 rq->current_entity = NULL; 77 rq->current_entity = NULL;
78 rq->sched = sched;
77} 79}
78 80
79/** 81/**
@@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
926 sched->timeout = timeout; 928 sched->timeout = timeout;
927 sched->hang_limit = hang_limit; 929 sched->hang_limit = hang_limit;
928 for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++) 930 for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++)
929 drm_sched_rq_init(&sched->sched_rq[i]); 931 drm_sched_rq_init(sched, &sched->sched_rq[i]);
930 932
931 init_waitqueue_head(&sched->wake_up_worker); 933 init_waitqueue_head(&sched->wake_up_worker);
932 init_waitqueue_head(&sched->job_scheduled); 934 init_waitqueue_head(&sched->job_scheduled);
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 4214ceb71c05..43e93d6077cf 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -93,6 +93,7 @@ struct drm_sched_entity {
93 * struct drm_sched_rq - queue of entities to be scheduled. 93 * struct drm_sched_rq - queue of entities to be scheduled.
94 * 94 *
95 * @lock: to modify the entities list. 95 * @lock: to modify the entities list.
96 * @sched: the scheduler to which this rq belongs to.
96 * @entities: list of the entities to be scheduled. 97 * @entities: list of the entities to be scheduled.
97 * @current_entity: the entity which is to be scheduled. 98 * @current_entity: the entity which is to be scheduled.
98 * 99 *
@@ -102,6 +103,7 @@ struct drm_sched_entity {
102 */ 103 */
103struct drm_sched_rq { 104struct drm_sched_rq {
104 spinlock_t lock; 105 spinlock_t lock;
106 struct drm_gpu_scheduler *sched;
105 struct list_head entities; 107 struct list_head entities;
106 struct drm_sched_entity *current_entity; 108 struct drm_sched_entity *current_entity;
107}; 109};