[Mesa-stable] [Mesa-dev][PATCH 1/1] winsys/amdgpu: Destroy dev_hash table when the last winsys is removed.

Marek Olšák maraeo at gmail.com
Fri May 11 02:53:17 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, May 10, 2018 at 7:27 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:

> Fixes memory leak on module unload.
>
> CC: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> index f4bbd3e732..84d8ca6fcf 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> @@ -220,8 +220,13 @@ static bool amdgpu_winsys_unref(struct radeon_winsys
> *rws)
>     simple_mtx_lock(&dev_tab_mutex);
>
>     destroy = pipe_reference(&ws->reference, NULL);
> -   if (destroy && dev_tab)
> +   if (destroy && dev_tab) {
>        util_hash_table_remove(dev_tab, ws->dev);
> +      if (util_hash_table_count(dev_tab) == 0) {
> +         util_hash_table_destroy(dev_tab);
> +         dev_tab = NULL;
> +      }
> +   }
>
>     simple_mtx_unlock(&dev_tab_mutex);
>     return destroy;
> --
> 2.17.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180510/eb31bfc7/attachment-0001.html>


More information about the mesa-stable mailing list