mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@mailbox.org>
To: Qianyi Liu <liuqianyi125@gmail.com>
Cc: airlied@gmail.com, ckoenig.leichtzumerken@gmail.com,
	dakr@kernel.org,  daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 maarten.lankhorst@linux.intel.com, matthew.brost@intel.com,
	mripard@kernel.org,  phasta@kernel.org, tzimmermann@suse.de
Subject: Re: [PATCH] drm/scheduler: Fix mem leak when last_scheduled signaled
Date: Tue, 25 Feb 2025 08:23:56 +0100	[thread overview]
Message-ID: <0bb7b9c428bdefe36afb43272c73da7e04a001ed.camel@mailbox.org> (raw)
In-Reply-To: <20250225031225.44102-1-liuqianyi125@gmail.com>

On Tue, 2025-02-25 at 11:12 +0800, Qianyi Liu wrote:
> Hello Philipp,
> 
> Thank you for your patient reply. Let's first clarify the issue and
> send a new
> patch if necessary.
> 
> As soon as it enters the drm_sched_entity_kill function, the entity
> ->last_scheduled reference count is incremented by 1. If there are
> still jobs in
> the current entity, it will enter the while loop, assuming there is
> only one job
> left. If entity->last_scheduled has already been signaled, it will
> enter
> drm_sched_entity_kill_jobs_cb, but because null is passed in, the
> last_scheduled reference count will not be correctly reduced by 1.
> 
> Because the prev pointer has been updated to &s_fence->finished, the
> dma_fence_put in the last line only reduces the reference count of
> s_fence->finished.
> The reference count of entity->last_scheduled was not reduced by
> 1, causing a memory leak.
> 
> We should subtract 1 from the reference count of the prev when
> dma_fence_add_callback
> fails, which is called balance.
> 
> Best Regards.
> QianYi.

OK, thanks for clarification.

I think, next to the other feedback, it would be good to have a brief
version of the above explanation in your commit message, since this
clearly describes the problem and the proposed solution.

Please address the feedback by Matt and myself in a v2.

(and btw., please don't remove the original e-mail content when
answering – that's uncommon on-list. Only when the threads are getting
huge one removes parts not addressed by the answer from the quoted
content ;)


Thanks
P.

  reply	other threads:[~2025-02-25  7:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  6:27 qianyi liu
2025-02-24  9:52 ` Philipp Stanner
2025-02-24  9:57   ` Philipp Stanner
2025-02-25  2:58   ` Qianyi Liu
2025-02-25  3:12   ` Qianyi Liu
2025-02-25  7:23     ` Philipp Stanner [this message]
2025-02-25  5:46   ` Matthew Brost
2025-02-25  8:19     ` Qianyi Liu
2025-02-25  7:18   ` Philipp Stanner
2025-02-25 13:09     ` Qianyi Liu
2025-02-25 14:00 ` Markus Elfring
2025-02-25 14:05   ` Philipp Stanner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bb7b9c428bdefe36afb43272c73da7e04a001ed.camel@mailbox.org \
    --to=phasta@mailbox.org \
    --cc=airlied@gmail.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuqianyi125@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=phasta@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®