[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b55a80c2-4253-4f14-b8f9-c37e1e55960b@amd.com>
Date: Mon, 28 Oct 2024 12:55:14 +0100
From: Christian König <christian.koenig@....com>
To: Hongling Zeng <zenghongling@...inos.cn>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org
Cc: alexander.deucher@....com, Xinhui.Pan@....com, airlied@...il.com,
simona@...ll.ch, zhongling0719@....com
Subject: Re: [PATCH] amdgpu/fence: replace call_rcu by kfree_rcu for simple
kmem_cache_free callback
Am 25.10.24 um 05:51 schrieb Hongling Zeng:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
I would rather prefer to completely remove the use of kmem_cache here
and for all other dma_fence implementations.
The object can live longer than the module which has caused us quite
some headache already.
Regards,
Christian.
>
> Signed-off-by: Hongling Zeng <zenghongling@...inos.cn>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 16 +---------------
> 1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 2f24a6a..d047afe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -818,20 +818,6 @@ static bool amdgpu_job_fence_enable_signaling(struct dma_fence *f)
> return true;
> }
>
> -/**
> - * amdgpu_fence_free - free up the fence memory
> - *
> - * @rcu: RCU callback head
> - *
> - * Free up the fence memory after the RCU grace period.
> - */
> -static void amdgpu_fence_free(struct rcu_head *rcu)
> -{
> - struct dma_fence *f = container_of(rcu, struct dma_fence, rcu);
> -
> - /* free fence_slab if it's separated fence*/
> - kmem_cache_free(amdgpu_fence_slab, to_amdgpu_fence(f));
> -}
>
> /**
> * amdgpu_job_fence_free - free up the job with embedded fence
> @@ -858,7 +844,7 @@ static void amdgpu_job_fence_free(struct rcu_head *rcu)
> */
> static void amdgpu_fence_release(struct dma_fence *f)
> {
> - call_rcu(&f->rcu, amdgpu_fence_free);
> + kfree_rcu(f, rcu);
> }
>
> /**
Powered by blists - more mailing lists