drm/amdgpu: fix unnecessary wake up

decrease CPU extra overhead.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
This commit is contained in:
Chunming Zhou 2015-08-13 13:04:06 +08:00 committed by Alex Deucher
parent 6d1d0ef743
commit 1c8f805af9
2 changed files with 7 additions and 4 deletions

View file

@ -158,7 +158,7 @@ select_context(struct amd_gpu_scheduler *sched)
if (sched->current_entity && (sched->current_entity != tmp)) if (sched->current_entity && (sched->current_entity != tmp))
wake_entity = sched->current_entity; wake_entity = sched->current_entity;
sched->current_entity = tmp; sched->current_entity = tmp;
if (wake_entity) if (wake_entity && wake_entity->need_wakeup)
wake_up(&wake_entity->wait_queue); wake_up(&wake_entity->wait_queue);
return tmp; return tmp;
} }
@ -195,6 +195,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
entity->fence_context = fence_context_alloc(1); entity->fence_context = fence_context_alloc(1);
snprintf(name, sizeof(name), "c_entity[%llu]", entity->fence_context); snprintf(name, sizeof(name), "c_entity[%llu]", entity->fence_context);
memcpy(entity->name, name, 20); memcpy(entity->name, name, 20);
entity->need_wakeup = false;
if(kfifo_alloc(&entity->job_queue, if(kfifo_alloc(&entity->job_queue,
jobs * sizeof(void *), jobs * sizeof(void *),
GFP_KERNEL)) GFP_KERNEL))
@ -257,7 +258,7 @@ int amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
if (!is_context_entity_initialized(sched, entity)) if (!is_context_entity_initialized(sched, entity))
return 0; return 0;
entity->need_wakeup = true;
/** /**
* The client will not queue more IBs during this fini, consume existing * The client will not queue more IBs during this fini, consume existing
* queued IBs * queued IBs
@ -323,8 +324,9 @@ int amd_sched_push_job(struct amd_gpu_scheduler *sched,
*/ */
schedule(); schedule();
} }
/* first job wake up scheduler */
wake_up_interruptible(&sched->wait_queue); if ((kfifo_len(&c_entity->job_queue) / sizeof(void *)) == 1)
wake_up_interruptible(&sched->wait_queue);
return 0; return 0;
} }

View file

@ -54,6 +54,7 @@ struct amd_sched_entity {
bool is_pending; bool is_pending;
uint64_t fence_context; uint64_t fence_context;
char name[20]; char name[20];
bool need_wakeup;
}; };
/** /**