]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/buddy: fix issue that force_merge cannot free all roots
authorLin.Cao <lincao12@amd.com>
Thu, 26 Dec 2024 07:01:15 +0000 (12:31 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:47 +0000 (11:13 +0200)
commit5b42058ffab0f040dead553673780e22eb3b0268
tree46b017adb449ff7d594656ee6d6aa4a53bd23714
parent7406496e2d74519c786cfdee6028d8441a399fdf
drm/buddy: fix issue that force_merge cannot free all roots

[ Upstream commit 467dce3817bd2b62ccd6fcfd7aae76f242ac907e ]

If buddy manager have more than one roots and each root have sub-block
need to be free. When drm_buddy_fini called, the first loop of
force_merge will merge and free all of the sub block of first root,
which offset is 0x0 and size is biggest(more than have of the mm size).
In subsequent force_merge rounds, if we use 0 as start and use remaining
mm size as end, the block of other roots will be skipped in
__force_merge function. It will cause the other roots can not be freed.

Solution: use roots' offset as the start could fix this issue.

Signed-off-by: Lin.Cao <lincao12@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241226070116.309290-1-Arunpravin.PaneerSelvam@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_buddy.c