[PATCH] drm/scheduler: select the least loaded sched during entity init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of assigning entity to the first scheduler in the list
assign it to the least loaded scheduler.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index 21fa0d8a8783..dbd707d24597 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -61,6 +61,8 @@
 static bool drm_sched_entity_is_ready(struct drm_sched_entity *entity);
 static void drm_sched_wakeup(struct drm_gpu_scheduler *sched);
 static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);
+static struct drm_sched_rq *
+drm_sched_entity_get_free_sched(struct drm_sched_entity *entity);
 
 /**
  * drm_sched_rq_init - initialize a given run queue struct
@@ -186,13 +188,13 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
 
 	memset(entity, 0, sizeof(struct drm_sched_entity));
 	INIT_LIST_HEAD(&entity->list);
-	entity->rq = rq_list[0];
 	entity->guilty = guilty;
 	entity->num_rq_list = num_rq_list;
 	entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *),
 				GFP_KERNEL);
 	for (i = 0; i < num_rq_list; ++i)
 		entity->rq_list[i] = rq_list[i];
+	entity->rq = drm_sched_entity_get_free_sched(entity);
 	entity->last_scheduled = NULL;
 
 	spin_lock_init(&entity->rq_lock);
-- 
2.14.3



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux