From: Qianyi Liu <liuqianyi125@gmail.com>
To: phasta@mailbox.org
Cc: airlied@gmail.com, ckoenig.leichtzumerken@gmail.com,
dakr@kernel.org, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
liuqianyi125@gmail.com, 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 11:12:25 +0800 [thread overview]
Message-ID: <20250225031225.44102-1-liuqianyi125@gmail.com> (raw)
In-Reply-To: <3b369e1a49b354852f361b103999673e4f7906a9.camel@mailbox.org>
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.
next prev parent reply other threads:[~2025-02-25 3:14 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 [this message]
2025-02-25 7:23 ` Philipp Stanner
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=20250225031225.44102-1-liuqianyi125@gmail.com \
--to=liuqianyi125@gmail.com \
--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=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=phasta@mailbox.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®