Commit f85a6dd9 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup entity picking

Cleanup function name, stop checking scheduler ready twice, but
check if kernel thread should stop instead.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
parent 9788ec40
...@@ -106,7 +106,7 @@ static bool amd_sched_ready(struct amd_gpu_scheduler *sched) ...@@ -106,7 +106,7 @@ static bool amd_sched_ready(struct amd_gpu_scheduler *sched)
* Select next entity containing real IB submissions * Select next entity containing real IB submissions
*/ */
static struct amd_sched_entity * static struct amd_sched_entity *
select_context(struct amd_gpu_scheduler *sched) amd_sched_select_context(struct amd_gpu_scheduler *sched)
{ {
struct amd_sched_entity *wake_entity = NULL; struct amd_sched_entity *wake_entity = NULL;
struct amd_sched_entity *tmp; struct amd_sched_entity *tmp;
...@@ -286,20 +286,24 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) ...@@ -286,20 +286,24 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
static int amd_sched_main(void *param) static int amd_sched_main(void *param)
{ {
int r;
struct amd_sched_job *job;
struct sched_param sparam = {.sched_priority = 1}; struct sched_param sparam = {.sched_priority = 1};
struct amd_sched_entity *c_entity = NULL;
struct amd_gpu_scheduler *sched = (struct amd_gpu_scheduler *)param; struct amd_gpu_scheduler *sched = (struct amd_gpu_scheduler *)param;
int r;
sched_setscheduler(current, SCHED_FIFO, &sparam); sched_setscheduler(current, SCHED_FIFO, &sparam);
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
struct amd_sched_entity *c_entity = NULL;
struct amd_sched_job *job;
struct fence *fence; struct fence *fence;
wait_event_interruptible(sched->wait_queue, wait_event_interruptible(sched->wait_queue,
amd_sched_ready(sched) && kthread_should_stop() ||
(c_entity = select_context(sched))); (c_entity = amd_sched_select_context(sched)));
if (!c_entity)
continue;
r = kfifo_out(&c_entity->job_queue, &job, sizeof(void *)); r = kfifo_out(&c_entity->job_queue, &job, sizeof(void *));
if (r != sizeof(void *)) if (r != sizeof(void *))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment