[PATCH v2] drm/sched: Avoid double re-lock on the job free path

Danilo Krummrich dakr at kernel.org
Fri Jul 11 19:22:20 UTC 2025


On 7/11/25 9:08 PM, Maíra Canal wrote:
> Hi Tvrtko,
> 
> On 11/07/25 12:09, Tvrtko Ursulin wrote:
>> Currently the job free work item will lock sched->job_list_lock first time
>> to see if there are any jobs, free a single job, and then lock again to
>> decide whether to re-queue itself if there are more finished jobs.
>>
>> Since drm_sched_get_finished_job() already looks at the second job in the
>> queue we can simply add the signaled check and have it return the presence
>> of more jobs to be freed to the caller. That way the work item does not
>> have to lock the list again and repeat the signaled check.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
>> Cc: Christian König <christian.koenig at amd.com>
>> Cc: Danilo Krummrich <dakr at kernel.org>
>> Cc: Matthew Brost <matthew.brost at intel.com>
>> Cc: Philipp Stanner <phasta at kernel.org>
>> ---
>> v2:
>>   * Improve commit text and kerneldoc. (Philipp)
>>   * Rename run free work helper. (Philipp)
> 
> Maybe, would it be possible not to rename it? Otherwise, I won't be able
> to use the function name `drm_sched_run_free_queue()` in the
> DRM_GPU_SCHED_STAT_NO_HANG series.
> 
> Not a big deal, but it would ease reintroducing
> `drm_sched_run_free_queue()` if the series lands after this patch.

Do you intend to land your series through a different tree?


More information about the Intel-xe mailing list