[PATCH] amdgpu/fence: replace call_rcu by kfree_rcu for simple kmem_cache_free callback

Hongling Zeng zenghongling at kylinos.cn
Fri Oct 25 03:51:10 UTC 2024


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.

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);
 }
 
 /**
-- 
2.1.0



More information about the amd-gfx mailing list