]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/vc4: bo: Fix drmm_mutex_init memory hog
authorMaxime Ripard <maxime@cerno.tech>
Thu, 12 Jan 2023 09:12:43 +0000 (10:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:09 +0000 (08:34 +0100)
commitbe960b061b894dc7e47c56e5784b04ba44c67107
tree5116e09d1f3c879986c37ce05eb97ba45baefd5e
parent86e1955b28d9211c8faa8946387951792aeba44d
drm/vc4: bo: Fix drmm_mutex_init memory hog

[ Upstream commit 07a2975c65f2be2e22591d795a9c39b00f95fd11 ]

Commit 374146cad469 ("drm/vc4: Switch to drmm_mutex_init") converted,
among other functions, vc4_create_object() to use drmm_mutex_init().

However, that function is used to allocate a BO, and therefore the
mutex needs to be freed much sooner than when the DRM device is removed
from the system.

For each buffer allocation we thus end up allocating a small structure
as part of the DRM-managed mechanism that is never freed, eventually
leading us to no longer having any free memory anymore.

Let's switch back to mutex_init/mutex_destroy to deal with it properly.

Fixes: 374146cad469 ("drm/vc4: Switch to drmm_mutex_init")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20230112091243.490799-1-maxime@cerno.tech
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/vc4/vc4_bo.c