[PATCH 2/2] drm/sched: Rename to drm_sched_wakeup_if_can_queue()

Christian König christian.koenig at amd.com
Wed May 31 09:11:50 UTC 2023


Looks good to me as well, but I'm wondering if we shouldn't just always 
wake the scheduler up here.

Christian.

Am 19.05.23 um 15:41 schrieb Alex Deucher:
> Series is:
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
>
> On Thu, May 18, 2023 at 9:03 AM Luben Tuikov <luben.tuikov at amd.com> wrote:
>> On 2023-05-17 19:35, Luben Tuikov wrote:
>>> Rename drm_sched_wakeup() to drm_sched_wakeup_if_canqueue() since the former
>>> is misleading, as it wakes up the GPU scheduler _only if_ more jobs can be
>>> queued to the underlying hardware.
>>>
>>> This distinction is important to make, since the wake conditional in the GPU
>>> scheduler thread wakes up when other conditions are also true, e.g. when there
>>> are jobs to be cleaned. For instance, a user might want to wake up the
>>> scheduler only because there are more jobs to clean, but whether we can queue
>>> more jobs is irrelevant.
>>>
>>> v2: Separate "canqueue" to "can_queue". (Alex D.)
>>>
>>> Cc: Christian König <christian.koenig at amd.com>
>>> Cc: Alex Deucher <Alexander.Deucher at amd.com>
>>> Signed-off-by: Luben Tuikov <luben.tuikov at amd.com>
>> ^ ping!
>>
>> Regards,
>> Luben
>>
>>> ---
>>>   drivers/gpu/drm/scheduler/sched_entity.c | 4 ++--
>>>   drivers/gpu/drm/scheduler/sched_main.c   | 6 +++---
>>>   include/drm/gpu_scheduler.h              | 2 +-
>>>   3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
>>> index cfb433e9200586..68e807ae136ad8 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_entity.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
>>> @@ -342,7 +342,7 @@ static void drm_sched_entity_wakeup(struct dma_fence *f,
>>>                container_of(cb, struct drm_sched_entity, cb);
>>>
>>>        drm_sched_entity_clear_dep(f, cb);
>>> -     drm_sched_wakeup(entity->rq->sched);
>>> +     drm_sched_wakeup_if_can_queue(entity->rq->sched);
>>>   }
>>>
>>>   /**
>>> @@ -565,7 +565,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)
>>>                if (drm_sched_policy == DRM_SCHED_POLICY_FIFO)
>>>                        drm_sched_rq_update_fifo(entity, submit_ts);
>>>
>>> -             drm_sched_wakeup(entity->rq->sched);
>>> +             drm_sched_wakeup_if_can_queue(entity->rq->sched);
>>>        }
>>>   }
>>>   EXPORT_SYMBOL(drm_sched_entity_push_job);
>>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
>>> index 8739322c30321b..b352227a605538 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>>> @@ -860,12 +860,12 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched)
>>>   }
>>>
>>>   /**
>>> - * drm_sched_wakeup - Wake up the scheduler when it is ready
>>> - *
>>> + * drm_sched_wakeup_if_can_queue - Wake up the scheduler
>>>    * @sched: scheduler instance
>>>    *
>>> + * Wake up the scheduler if we can queue jobs.
>>>    */
>>> -void drm_sched_wakeup(struct drm_gpu_scheduler *sched)
>>> +void drm_sched_wakeup_if_can_queue(struct drm_gpu_scheduler *sched)
>>>   {
>>>        if (drm_sched_can_queue(sched))
>>>                wake_up_interruptible(&sched->wake_up_worker);
>>> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
>>> index 31d1f5166c79fe..e95b4837e5a373 100644
>>> --- a/include/drm/gpu_scheduler.h
>>> +++ b/include/drm/gpu_scheduler.h
>>> @@ -549,7 +549,7 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity,
>>>                                      unsigned int num_sched_list);
>>>
>>>   void drm_sched_job_cleanup(struct drm_sched_job *job);
>>> -void drm_sched_wakeup(struct drm_gpu_scheduler *sched);
>>> +void drm_sched_wakeup_if_can_queue(struct drm_gpu_scheduler *sched);
>>>   void drm_sched_stop(struct drm_gpu_scheduler *sched, struct drm_sched_job *bad);
>>>   void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery);
>>>   void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched);



More information about the dri-devel mailing list