Skip to contentSkip to conversation

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

PATCH In review Nayan Deshmukh 3 participants 3 messages Aug 3, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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

---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/gpu_scheduler.c +3 -1
index 21fa0d8a8783..dbd707d24597 100644
@@ -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);
Signature · 6 lines
2.14.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh:

Quoted 2 lines

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

I thought about that as well, but then abandoned the idea.

The reason is that we are going to reassign the rq when the first job is pushed to it anyway.

This will only become useful when we take the number of entities a rq has into account for the decision as well.

Christian.

Quoted 24 lines
---
  drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/gpu_scheduler.c +2 -1
index 21fa0d8a8783..dbd707d24597 100644
@@ -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];

drivers/gpu/drm/scheduler/gpu_scheduler.c int drm_sched_entity_init(struct drm_sched_entity *entity, · line 200

Quoted 10 lines
drivers/gpu/drm/scheduler/gpu_scheduler.c +1 -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);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Ah...you are correct. We will reschedule on the first job push. I didn't take that into account. Let's drop this patch then.

Thanks,
Nayan

Quoted 38 lines · Christian König

Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh:

Quoted 2 lines

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

I thought about that as well, but then abandoned the idea.

The reason is that we are going to reassign the rq when the first job is pushed to it anyway.

This will only become useful when we take the number of entities a rq has into account for the decision as well.

Christian.

Review

Quoted 7 lines
---
  drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

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

drivers/gpu/drm/scheduler/gpu_scheduler.c line 63

Quoted 7 lines

index 21fa0d8a8783..dbd707d24597 100644

drivers/gpu/drm/scheduler/gpu_scheduler.c +0 -0
@@ -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);

drivers/gpu/drm/scheduler/gpu_scheduler.c int drm_sched_entity_init(struct drm_sched_entity

Quoted 6 lines
drivers/gpu/drm/scheduler/gpu_scheduler.c +2 -0
+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,

Quoted 1 line
Quoted 16 lines
Quoted 6 lines
      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

*),

Quoted 7 lines
                              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);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel