Re: [PATCH v2 1/2] drm/sched: Make drm_sched_entity_kill() a public function

From: Luben Tuikov

Date: Fri Apr 17 2026 - 00:38:20 EST


On 2026-04-15 10:49, Philipp Stanner wrote:
> Some drivers do not care on teardown whether the last jobs pending in an
> entity are actually executed before teardown completed. For such
> scenarios, drm_sched_entity_flush() is not the ideal function since it's
> intended to wait for jobs to complete.
>
> Make drm_sched_entity_kill() public for that use-case and update the
> documentation.

This is a good patch and great suggestion by Danilo.

>
> Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Philipp Stanner <phasta@xxxxxxxxxx>
> ---
> Changes in v2:
> - Improve wording, fix typo.
> ---
> drivers/gpu/drm/scheduler/sched_entity.c | 13 +++++++++++--
> include/drm/gpu_scheduler.h | 1 +
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index 61a4818cc87b..7be5811b90cd 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -267,8 +267,16 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,
> schedule_work(&job->work);
> }
>
> -/* Remove the entity from the scheduler and kill all pending jobs */
> -static void drm_sched_entity_kill(struct drm_sched_entity *entity)
> +/**
> + * drm_sched_entity_kill - kill an entity's pending jobs and remove it
> + * @entity: the entity to remove
> + *
> + * Removes the entity from the scheduler's run queue and kills all pending jobs.
> + *
> + * This function should be used over drm_sched_entity_flush() if it is not
> + * desired to actually wait for all pending jobs to finish.
> + */

I felt that the email body above describing this patch was somewhat clearer. Perhaps something like:
(Notice the change "if" --> "when".)

"Use this function over drm_sched_entity_flush(), when the caller is not interested to wait
for pending jobs to complete. This function kills any pending jobs."

--
Regards,
Luben

Attachment: OpenPGP_0x4C15479431A334AF.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature