* [PATCH] drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq()
@ 2023-03-21 17:58 Christophe JAILLET
2023-03-22 15:15 ` Hamza Mahfooz
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2023-03-21 17:58 UTC (permalink / raw)
To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
christian.koenig, Xinhui.Pan, airlied, daniel, aurabindo.pillai,
roman.li, hersenxs.wu, stylon.wang
Cc: amd-gfx, dri-devel, linux-kernel, kernel-janitors, Christophe JAILLET
A kzalloc()+memcpy() can be optimized in a single kmemdup().
This saves a few cycles because some memory doesn't need to be zeroed.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 5bac5781a06b..57a5fbdab890 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
DRM_ERROR("Failed to allocate dmub_hpd_wrk");
return;
}
- dmub_hpd_wrk->dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_ATOMIC);
+ dmub_hpd_wrk->dmub_notify = kmemdup(¬ify, sizeof(struct dmub_notification),
+ GFP_ATOMIC);
if (!dmub_hpd_wrk->dmub_notify) {
kfree(dmub_hpd_wrk);
DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify");
return;
}
INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work);
- if (dmub_hpd_wrk->dmub_notify)
- memcpy(dmub_hpd_wrk->dmub_notify, ¬ify, sizeof(struct dmub_notification));
dmub_hpd_wrk->adev = adev;
if (notify.type == DMUB_NOTIFICATION_HPD) {
plink = adev->dm.dc->links[notify.link_index];
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq()
2023-03-21 17:58 [PATCH] drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq() Christophe JAILLET
@ 2023-03-22 15:15 ` Hamza Mahfooz
0 siblings, 0 replies; 2+ messages in thread
From: Hamza Mahfooz @ 2023-03-22 15:15 UTC (permalink / raw)
To: Christophe JAILLET, harry.wentland, sunpeng.li, Rodrigo.Siqueira,
alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
aurabindo.pillai, roman.li, hersenxs.wu, stylon.wang
Cc: kernel-janitors, dri-devel, amd-gfx, linux-kernel
On 3/21/23 13:58, Christophe JAILLET wrote:
> A kzalloc()+memcpy() can be optimized in a single kmemdup().
> This saves a few cycles because some memory doesn't need to be zeroed.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied, thanks!
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 5bac5781a06b..57a5fbdab890 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
> DRM_ERROR("Failed to allocate dmub_hpd_wrk");
> return;
> }
> - dmub_hpd_wrk->dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_ATOMIC);
> + dmub_hpd_wrk->dmub_notify = kmemdup(¬ify, sizeof(struct dmub_notification),
> + GFP_ATOMIC);
> if (!dmub_hpd_wrk->dmub_notify) {
> kfree(dmub_hpd_wrk);
> DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify");
> return;
> }
> INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work);
> - if (dmub_hpd_wrk->dmub_notify)
> - memcpy(dmub_hpd_wrk->dmub_notify, ¬ify, sizeof(struct dmub_notification));
> dmub_hpd_wrk->adev = adev;
> if (notify.type == DMUB_NOTIFICATION_HPD) {
> plink = adev->dm.dc->links[notify.link_index];
--
Hamza
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-22 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 17:58 [PATCH] drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq() Christophe JAILLET
2023-03-22 15:15 ` Hamza Mahfooz
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).