For where the cache name and the structure name match.
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Kunwu Chan (3):
drm/amdgpu: Simplify the allocation of fence slab caches
drm/amdgpu: Simplify the allocation of mux_chunk slab caches
drm/amdgpu: Simplify the allocation of sync slab caches
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +---
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 4 +---
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 4 +---
3 files changed, 3 insertions(+), 9 deletions(-)
--
2.39.2
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c
index e1ee1c7117fb..d234b7ccfaaf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c
@@ -159,9 +159,7 @@ int amdgpu_ring_mux_init(struct amdgpu_ring_mux *mux, struct amdgpu_ring *ring,
mux->ring_entry_size = entry_size;
mux->s_resubmit = false;
- amdgpu_mux_chunk_slab = kmem_cache_create("amdgpu_mux_chunk",
- sizeof(struct amdgpu_mux_chunk), 0,
- SLAB_HWCACHE_ALIGN, NULL);
+ amdgpu_mux_chunk_slab = KMEM_CACHE(amdgpu_mux_chunk, SLAB_HWCACHE_ALIGN);
if (!amdgpu_mux_chunk_slab) {
DRM_ERROR("create amdgpu_mux_chunk cache failed\n");
return -ENOMEM;
--
2.39.2
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 1b013a44ca99..bdf1ef825d89 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -441,9 +441,7 @@ void amdgpu_sync_free(struct amdgpu_sync *sync)
*/
int amdgpu_sync_init(void)
{
- amdgpu_sync_slab = kmem_cache_create(
- "amdgpu_sync", sizeof(struct amdgpu_sync_entry), 0,
- SLAB_HWCACHE_ALIGN, NULL);
+ amdgpu_sync_slab = KMEM_CACHE(amdgpu_sync_entry, SLAB_HWCACHE_ALIGN);
if (!amdgpu_sync_slab)
return -ENOMEM;
--
2.39.2
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 70bff8cecfda..10832b470448 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -61,9 +61,7 @@ static struct kmem_cache *amdgpu_fence_slab;
int amdgpu_fence_slab_init(void)
{
- amdgpu_fence_slab = kmem_cache_create(
- "amdgpu_fence", sizeof(struct amdgpu_fence), 0,
- SLAB_HWCACHE_ALIGN, NULL);
+ amdgpu_fence_slab = KMEM_CACHE(amdgpu_fence, SLAB_HWCACHE_ALIGN);
if (!amdgpu_fence_slab)
return -ENOMEM;
return 0;
--
2.39.2
Am 21.02.24 um 10:59 schrieb Kunwu Chan:
> For where the cache name and the structure name match.
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
Reviewed-by: Christian König <[email protected]> for the entire
series.
>
> Kunwu Chan (3):
> drm/amdgpu: Simplify the allocation of fence slab caches
> drm/amdgpu: Simplify the allocation of mux_chunk slab caches
> drm/amdgpu: Simplify the allocation of sync slab caches
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 4 +---
> drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 4 +---
> 3 files changed, 3 insertions(+), 9 deletions(-)
>
Applied. Thanks!
On Wed, Feb 21, 2024 at 6:08 AM Christian König
<[email protected]> wrote:
>
> Am 21.02.24 um 10:59 schrieb Kunwu Chan:
> > For where the cache name and the structure name match.
> > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> > to simplify the creation of SLAB caches.
>
> Reviewed-by: Christian König <[email protected]> for the entire
> series.
>
> >
> > Kunwu Chan (3):
> > drm/amdgpu: Simplify the allocation of fence slab caches
> > drm/amdgpu: Simplify the allocation of mux_chunk slab caches
> > drm/amdgpu: Simplify the allocation of sync slab caches
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 4 +---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 4 +---
> > 3 files changed, 3 insertions(+), 9 deletions(-)
> >
>