diff mbox series

drm/scheduler: Fix job cleanup without timeout handler

Message ID 20190520225058.21406-1-nunes.erico@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/scheduler: Fix job cleanup without timeout handler | expand

Commit Message

Erico Nunes May 20, 2019, 10:50 p.m. UTC
After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are
only deleted when the timeout handler is able to be cancelled
successfully.

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT),
job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in
drm_sched_cleanup_jobs.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Erico Nunes May 20, 2019, 10:58 p.m. UTC | #1
On Tue, May 21, 2019 at 12:51 AM Erico Nunes <nunes.erico@gmail.com> wrote:
>
> After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are
> only deleted when the timeout handler is able to be cancelled
> successfully.
>
> In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT),
> job cleanup would be skipped which may result in memory leaks.
>
> Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in
> drm_sched_cleanup_jobs.
>
> Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
> Cc: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index f8f0e1c19002..07ecaba15127 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
>         unsigned long flags;
>
>         /* Don't destroy jobs while the timeout worker is running */
> -       if (!cancel_delayed_work(&sched->work_tdr))
> +       if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
> +           cancel_delayed_work(&sched->work_tdr))
>                 return;

Nevermind this one, there is a typo. I'll resend.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index f8f0e1c19002..07ecaba15127 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -630,7 +630,8 @@  static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
 	unsigned long flags;
 
 	/* Don't destroy jobs while the timeout worker is running */
-	if (!cancel_delayed_work(&sched->work_tdr))
+	if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
+	    cancel_delayed_work(&sched->work_tdr))
 		return;