dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] drm/amdgpu: use KMEM_CACHE instead of kmem_cache_create
       [not found] <20250902072759.2386131-1-xialonglong@kylinos.cn>
@ 2025-09-02 11:39 ` Christian König
  0 siblings, 0 replies; only message in thread
From: Christian König @ 2025-09-02 11:39 UTC (permalink / raw)
  To: Longlong Xia, alexander.deucher; +Cc: amd-gfx, dri-devel, linux-kernel

On 02.09.25 09:27, Longlong Xia wrote:
> Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

In general a good cleanup, but why are we using a separate kmem_cache here in the first place?

SLAB_HWCACHE_ALIGN rounds up the struct size to 128 bytes and that is something kzalloc() can return as well.

Regards,
Christian.

> 
> Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index c2a983ff23c9..51f51064685f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -37,11 +37,7 @@ static struct kmem_cache *amdgpu_userq_fence_slab;
>  
>  int amdgpu_userq_fence_slab_init(void)
>  {
> -	amdgpu_userq_fence_slab = kmem_cache_create("amdgpu_userq_fence",
> -						    sizeof(struct amdgpu_userq_fence),
> -						    0,
> -						    SLAB_HWCACHE_ALIGN,
> -						    NULL);
> +	amdgpu_userq_fence_slab = KMEM_CACHE(amdgpu_userq_fence, SLAB_HWCACHE_ALIGN);
>  	if (!amdgpu_userq_fence_slab)
>  		return -ENOMEM;
>  


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-02 11:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250902072759.2386131-1-xialonglong@kylinos.cn>
2025-09-02 11:39 ` [PATCH 1/1] drm/amdgpu: use KMEM_CACHE instead of kmem_cache_create Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).