Skip to content

Commit 8dc9fbb

Browse files
ndesh26alexdeucher
authored andcommitted
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>
1 parent b7d85e1 commit 8dc9fbb

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/gpu/drm/scheduler/gpu_scheduler.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);
6969
*
7070
* Initializes a scheduler runqueue.
7171
*/
72-
static void drm_sched_rq_init(struct drm_sched_rq *rq)
72+
static void drm_sched_rq_init(struct drm_gpu_scheduler *sched,
73+
struct drm_sched_rq *rq)
7374
{
7475
spin_lock_init(&rq->lock);
7576
INIT_LIST_HEAD(&rq->entities);
7677
rq->current_entity = NULL;
78+
rq->sched = sched;
7779
}
7880

7981
/**
@@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
926928
sched->timeout = timeout;
927929
sched->hang_limit = hang_limit;
928930
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]);
930932

931933
init_waitqueue_head(&sched->wake_up_worker);
932934
init_waitqueue_head(&sched->job_scheduled);

‎include/drm/gpu_scheduler.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct drm_sched_entity {
9393
* struct drm_sched_rq - queue of entities to be scheduled.
9494
*
9595
* @lock: to modify the entities list.
96+
* @sched: the scheduler to which this rq belongs to.
9697
* @entities: list of the entities to be scheduled.
9798
* @current_entity: the entity which is to be scheduled.
9899
*
@@ -102,6 +103,7 @@ struct drm_sched_entity {
102103
*/
103104
struct drm_sched_rq {
104105
spinlock_t lock;
106+
struct drm_gpu_scheduler *sched;
105107
struct list_head entities;
106108
struct drm_sched_entity *current_entity;
107109
};

0 commit comments

Comments
 (0)