summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/scheduler
diff options
context:
space:
mode:
authorNirmoy Das <nirmoy.das@amd.com>2019-12-10 00:52:25 +0300
committerAlex Deucher <alexander.deucher@amd.com>2019-12-19 00:09:12 +0300
commit8c23056bdc7ae024f059460f5750536a91922b7a (patch)
treee944534b0e7354279e31d80d5a61424ffe1fc214 /drivers/gpu/drm/scheduler
parentf880799d7fcf0a63ca2295d950cd12f5520251d9 (diff)
downloadlinux-8c23056bdc7ae024f059460f5750536a91922b7a.tar.xz
drm/scheduler: do not keep a copy of sched list
entity should not keep copy and maintain sched list for itself. Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/scheduler')
-rw-r--r--drivers/gpu/drm/scheduler/sched_entity.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index f9b6ce29c58f..2e3a058fc239 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -56,8 +56,6 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
unsigned int num_sched_list,
atomic_t *guilty)
{
- int i;
-
if (!(entity && sched_list && (num_sched_list == 0 || sched_list[0])))
return -EINVAL;
@@ -67,22 +65,14 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
entity->guilty = guilty;
entity->num_sched_list = num_sched_list;
entity->priority = priority;
- entity->sched_list = kcalloc(num_sched_list,
- sizeof(struct drm_gpu_scheduler *), GFP_KERNEL);
+ entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
+ entity->last_scheduled = NULL;
- if(!entity->sched_list)
- return -ENOMEM;
+ if(num_sched_list)
+ entity->rq = &sched_list[0]->sched_rq[entity->priority];
init_completion(&entity->entity_idle);
- for (i = 0; i < num_sched_list; i++)
- entity->sched_list[i] = sched_list[i];
-
- if (num_sched_list)
- entity->rq = &entity->sched_list[0]->sched_rq[entity->priority];
-
- entity->last_scheduled = NULL;
-
spin_lock_init(&entity->rq_lock);
spsc_queue_init(&entity->job_queue);
@@ -312,7 +302,6 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity)
dma_fence_put(entity->last_scheduled);
entity->last_scheduled = NULL;
- kfree(entity->sched_list);
}
EXPORT_SYMBOL(drm_sched_entity_fini);