lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0d2d6d3e-594c-445e-96f4-c2a7991d2b14@amd.com>
Date: Tue, 2 Sep 2025 13:39:32 +0200
From: Christian König <christian.koenig@....com>
To: Longlong Xia <xialonglong@...inos.cn>, alexander.deucher@....com
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] drm/amdgpu: use KMEM_CACHE instead of
 kmem_cache_create

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@...inos.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;
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ