[PATCH] drm/scheduler: select the least loaded sched during entity init
Christian König
ckoenig.leichtzumerken at gmail.com
Fri Aug 3 10:42:49 UTC 2018
Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh:
> 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.
>
> 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);
More information about the dri-devel
mailing list