[PATCH] amdgpu/fence: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
Christian König
christian.koenig at amd.com
Mon Oct 28 11:55:14 UTC 2024
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 at kylinos.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);
> }
>
> /**
More information about the amd-gfx
mailing list