mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-06-29 23:43:21 -04:00
drm/vc4: bo: Fix drmm_mutex_init memory hog
Commit374146cad4
("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:374146cad4
("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
This commit is contained in:
parent
5640e81607
commit
07a2975c65
1 changed files with 2 additions and 3 deletions
|
@ -179,6 +179,7 @@ static void vc4_bo_destroy(struct vc4_bo *bo)
|
||||||
bo->validated_shader = NULL;
|
bo->validated_shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_destroy(&bo->madv_lock);
|
||||||
drm_gem_dma_free(&bo->base);
|
drm_gem_dma_free(&bo->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,9 +407,7 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
|
||||||
bo->madv = VC4_MADV_WILLNEED;
|
bo->madv = VC4_MADV_WILLNEED;
|
||||||
refcount_set(&bo->usecnt, 0);
|
refcount_set(&bo->usecnt, 0);
|
||||||
|
|
||||||
ret = drmm_mutex_init(dev, &bo->madv_lock);
|
mutex_init(&bo->madv_lock);
|
||||||
if (ret)
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
|
|
||||||
mutex_lock(&vc4->bo_lock);
|
mutex_lock(&vc4->bo_lock);
|
||||||
bo->label = VC4_BO_TYPE_KERNEL;
|
bo->label = VC4_BO_TYPE_KERNEL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue