From: "Christian König" <christian.koenig@amd.com>
To: Longlong Xia <xialonglong@kylinos.cn>, alexander.deucher@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] drm/amdgpu: use KMEM_CACHE instead of kmem_cache_create
Date: Tue, 2 Sep 2025 13:39:32 +0200 [thread overview]
Message-ID: <0d2d6d3e-594c-445e-96f4-c2a7991d2b14@amd.com> (raw)
In-Reply-To: <20250902072759.2386131-1-xialonglong@kylinos.cn>
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;
>
prev parent reply other threads:[~2025-09-02 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 7:27 Longlong Xia
2025-09-02 11:39 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d2d6d3e-594c-445e-96f4-c2a7991d2b14@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xialonglong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®