mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create
@ 2024-02-21  9:59 Kunwu Chan
  2024-02-21  9:59 ` [PATCH 1/3] drm/amdgpu: Simplify the allocation of fence slab caches Kunwu Chan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Kunwu Chan @ 2024-02-21  9:59 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, 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.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] drm/amdgpu: Simplify the allocation of fence slab caches
  2024-02-21  9:59 [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
@ 2024-02-21  9:59 ` Kunwu Chan
  2024-02-21  9:59 ` [PATCH 2/3] drm/amdgpu: Simplify the allocation of mux_chunk " Kunwu Chan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Kunwu Chan @ 2024-02-21  9:59 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, Kunwu Chan

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] drm/amdgpu: Simplify the allocation of mux_chunk slab caches
  2024-02-21  9:59 [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
  2024-02-21  9:59 ` [PATCH 1/3] drm/amdgpu: Simplify the allocation of fence slab caches Kunwu Chan
@ 2024-02-21  9:59 ` Kunwu Chan
  2024-02-21  9:59 ` [PATCH 3/3] drm/amdgpu: Simplify the allocation of sync " Kunwu Chan
  2024-02-21 10:57 ` [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Christian König
  3 siblings, 0 replies; 6+ messages in thread
From: Kunwu Chan @ 2024-02-21  9:59 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, Kunwu Chan

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] drm/amdgpu: Simplify the allocation of sync slab caches
  2024-02-21  9:59 [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
  2024-02-21  9:59 ` [PATCH 1/3] drm/amdgpu: Simplify the allocation of fence slab caches Kunwu Chan
  2024-02-21  9:59 ` [PATCH 2/3] drm/amdgpu: Simplify the allocation of mux_chunk " Kunwu Chan
@ 2024-02-21  9:59 ` Kunwu Chan
  2024-02-21 10:57 ` [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Christian König
  3 siblings, 0 replies; 6+ messages in thread
From: Kunwu Chan @ 2024-02-21  9:59 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, Kunwu Chan

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create
  2024-02-21  9:59 [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
                   ` (2 preceding siblings ...)
  2024-02-21  9:59 ` [PATCH 3/3] drm/amdgpu: Simplify the allocation of sync " Kunwu Chan
@ 2024-02-21 10:57 ` Christian König
  2024-02-21 20:34   ` Alex Deucher
  3 siblings, 1 reply; 6+ messages in thread
From: Christian König @ 2024-02-21 10:57 UTC (permalink / raw)
  To: Kunwu Chan, alexander.deucher, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel

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 <christian.koenig@amd.com> 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(-)
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create
  2024-02-21 10:57 ` [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Christian König
@ 2024-02-21 20:34   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2024-02-21 20:34 UTC (permalink / raw)
  To: Christian König
  Cc: Kunwu Chan, alexander.deucher, Xinhui.Pan, airlied, daniel,
	amd-gfx, dri-devel, linux-kernel

Applied.  Thanks!

On Wed, Feb 21, 2024 at 6:08 AM Christian König
<christian.koenig@amd.com> 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 <christian.koenig@amd.com> 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(-)
> >
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-21 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21  9:59 [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Kunwu Chan
2024-02-21  9:59 ` [PATCH 1/3] drm/amdgpu: Simplify the allocation of fence slab caches Kunwu Chan
2024-02-21  9:59 ` [PATCH 2/3] drm/amdgpu: Simplify the allocation of mux_chunk " Kunwu Chan
2024-02-21  9:59 ` [PATCH 3/3] drm/amdgpu: Simplify the allocation of sync " Kunwu Chan
2024-02-21 10:57 ` [PATCH 0/3] drm/amdgpu: Use KMEM_CACHE instead of kmem_cache_create Christian König
2024-02-21 20:34   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®