Skip to content

Commit 6843852

Browse files
committed
drm/amdgpu: remove fence slab
Just use kmalloc for the fences in the rare case we need an independent fence. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 49f1f9f commit 6843852

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,6 @@ struct amdgpu_sa_manager {
470470
void *cpu_ptr;
471471
};
472472

473-
int amdgpu_fence_slab_init(void);
474-
void amdgpu_fence_slab_fini(void);
475-
476473
/*
477474
* IRQS.
478475
*/

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,10 +3113,6 @@ static int __init amdgpu_init(void)
31133113
if (r)
31143114
goto error_sync;
31153115

3116-
r = amdgpu_fence_slab_init();
3117-
if (r)
3118-
goto error_fence;
3119-
31203116
r = amdgpu_userq_fence_slab_init();
31213117
if (r)
31223118
goto error_fence;
@@ -3151,7 +3147,6 @@ static void __exit amdgpu_exit(void)
31513147
amdgpu_unregister_atpx_handler();
31523148
amdgpu_acpi_release();
31533149
amdgpu_sync_fini();
3154-
amdgpu_fence_slab_fini();
31553150
amdgpu_userq_fence_slab_fini();
31563151
mmu_notifier_synchronize();
31573152
amdgpu_xcp_drv_release();

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@
4141
#include "amdgpu_trace.h"
4242
#include "amdgpu_reset.h"
4343

44-
static struct kmem_cache *amdgpu_fence_slab;
45-
46-
int amdgpu_fence_slab_init(void)
47-
{
48-
amdgpu_fence_slab = KMEM_CACHE(amdgpu_fence, SLAB_HWCACHE_ALIGN);
49-
if (!amdgpu_fence_slab)
50-
return -ENOMEM;
51-
return 0;
52-
}
53-
54-
void amdgpu_fence_slab_fini(void)
55-
{
56-
rcu_barrier();
57-
kmem_cache_destroy(amdgpu_fence_slab);
58-
}
5944
/*
6045
* Cast helper
6146
*/
@@ -131,9 +116,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, struct amd
131116
int r;
132117

133118
if (job == NULL) {
134-
/* create a sperate hw fence */
135-
am_fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_ATOMIC);
136-
if (am_fence == NULL)
119+
/* create a separate hw fence */
120+
am_fence = kzalloc(sizeof(*am_fence), GFP_KERNEL);
121+
if (!am_fence)
137122
return -ENOMEM;
138123
} else {
139124
/* take use of job-embedded fence */
@@ -814,7 +799,7 @@ static void amdgpu_fence_free(struct rcu_head *rcu)
814799
struct dma_fence *f = container_of(rcu, struct dma_fence, rcu);
815800

816801
/* free fence_slab if it's separated fence*/
817-
kmem_cache_free(amdgpu_fence_slab, to_amdgpu_fence(f));
802+
kfree(to_amdgpu_fence(f));
818803
}
819804

820805
/**

0 commit comments

Comments
 (0)