linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state
@ 2022-01-18 13:37 AngeloGioacchino Del Regno
  2022-01-18 13:37 ` [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state AngeloGioacchino Del Regno
  2022-01-25 16:36 ` [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state Chun-Kuang Hu
  0 siblings, 2 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-18 13:37 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, daniel, matthias.bgg, dri-devel,
	linux-mediatek, linux-arm-kernel, linux-kernel, kernel,
	AngeloGioacchino Del Regno

There is no need to zero out the newly allocated memory because we are
duplicating all members of struct mtk_plane_state: switch to kmalloc
to save some overhead.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index c74cb94e445e..39cb9a80d976 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -57,7 +57,7 @@ static struct drm_plane_state *mtk_plane_duplicate_state(struct drm_plane *plane
 	struct mtk_plane_state *old_state = to_mtk_plane_state(plane->state);
 	struct mtk_plane_state *state;
 
-	state = kzalloc(sizeof(*state), GFP_KERNEL);
+	state = kmalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
 
-- 
2.33.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state
  2022-01-18 13:37 [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state AngeloGioacchino Del Regno
@ 2022-01-18 13:37 ` AngeloGioacchino Del Regno
  2022-01-25 16:37   ` Chun-Kuang Hu
  2022-01-25 16:36 ` [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state Chun-Kuang Hu
  1 sibling, 1 reply; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-18 13:37 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, daniel, matthias.bgg, dri-devel,
	linux-mediatek, linux-arm-kernel, linux-kernel, kernel,
	AngeloGioacchino Del Regno

Optimize mtk_drm_crtc_duplicate_state() by switching from kzalloc() to
kmalloc(): the only variable of this struct that gets checked in other
functions is `pending_config`, but if that's set to false, then all of
the remaining variables will only ever be set, but not read - so, also
set `pending_config` to false.
This saves us some small overhead.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 09fc9ad02c7a..f536a0a927e4 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -185,7 +185,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc
 {
 	struct mtk_crtc_state *state;
 
-	state = kzalloc(sizeof(*state), GFP_KERNEL);
+	state = kmalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
 
@@ -193,6 +193,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc
 
 	WARN_ON(state->base.crtc != crtc);
 	state->base.crtc = crtc;
+	state->pending_config = false;
 
 	return &state->base;
 }
-- 
2.33.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state
  2022-01-18 13:37 [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state AngeloGioacchino Del Regno
  2022-01-18 13:37 ` [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state AngeloGioacchino Del Regno
@ 2022-01-25 16:36 ` Chun-Kuang Hu
  2022-03-16 10:40   ` AngeloGioacchino Del Regno
  1 sibling, 1 reply; 6+ messages in thread
From: Chun-Kuang Hu @ 2022-01-25 16:36 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel,
	Collabora Kernel ML

Hi, AngeloGioacchino:

AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
2022年1月18日 週二 下午9:38寫道:
>
> There is no need to zero out the newly allocated memory because we are
> duplicating all members of struct mtk_plane_state: switch to kmalloc
> to save some overhead.

Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index c74cb94e445e..39cb9a80d976 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -57,7 +57,7 @@ static struct drm_plane_state *mtk_plane_duplicate_state(struct drm_plane *plane
>         struct mtk_plane_state *old_state = to_mtk_plane_state(plane->state);
>         struct mtk_plane_state *state;
>
> -       state = kzalloc(sizeof(*state), GFP_KERNEL);
> +       state = kmalloc(sizeof(*state), GFP_KERNEL);
>         if (!state)
>                 return NULL;
>
> --
> 2.33.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state
  2022-01-18 13:37 ` [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state AngeloGioacchino Del Regno
@ 2022-01-25 16:37   ` Chun-Kuang Hu
  0 siblings, 0 replies; 6+ messages in thread
From: Chun-Kuang Hu @ 2022-01-25 16:37 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel,
	Collabora Kernel ML

Hi, AngeloGioacchino:

AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
2022年1月18日 週二 下午9:41寫道:
>
> Optimize mtk_drm_crtc_duplicate_state() by switching from kzalloc() to
> kmalloc(): the only variable of this struct that gets checked in other
> functions is `pending_config`, but if that's set to false, then all of
> the remaining variables will only ever be set, but not read - so, also
> set `pending_config` to false.
> This saves us some small overhead.

Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 09fc9ad02c7a..f536a0a927e4 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -185,7 +185,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc
>  {
>         struct mtk_crtc_state *state;
>
> -       state = kzalloc(sizeof(*state), GFP_KERNEL);
> +       state = kmalloc(sizeof(*state), GFP_KERNEL);
>         if (!state)
>                 return NULL;
>
> @@ -193,6 +193,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc
>
>         WARN_ON(state->base.crtc != crtc);
>         state->base.crtc = crtc;
> +       state->pending_config = false;
>
>         return &state->base;
>  }
> --
> 2.33.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state
  2022-01-25 16:36 ` [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state Chun-Kuang Hu
@ 2022-03-16 10:40   ` AngeloGioacchino Del Regno
  2022-03-16 15:12     ` Chun-Kuang Hu
  0 siblings, 1 reply; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-16 10:40 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	DRI Development, moderated list:ARM/Mediatek SoC support,
	Linux ARM, linux-kernel, Collabora Kernel ML

Il 25/01/22 17:36, Chun-Kuang Hu ha scritto:
> Hi, AngeloGioacchino:
> 
> AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
> 2022年1月18日 週二 下午9:38寫道:
>>
>> There is no need to zero out the newly allocated memory because we are
>> duplicating all members of struct mtk_plane_state: switch to kmalloc
>> to save some overhead.
> 
> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> 
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>

Hello,

this series was sent and reviewed two months ago, but it hasn't been picked
in any maintainer tree.

This is a friendly ping to not let these two patches to be lost and forgotten.

Cheers,
Angelo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state
  2022-03-16 10:40   ` AngeloGioacchino Del Regno
@ 2022-03-16 15:12     ` Chun-Kuang Hu
  0 siblings, 0 replies; 6+ messages in thread
From: Chun-Kuang Hu @ 2022-03-16 15:12 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel,
	Collabora Kernel ML

Hi, Angelo:

AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
2022年3月16日 週三 下午6:40寫道:
>
> Il 25/01/22 17:36, Chun-Kuang Hu ha scritto:
> > Hi, AngeloGioacchino:
> >
> > AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
> > 2022年1月18日 週二 下午9:38寫道:
> >>
> >> There is no need to zero out the newly allocated memory because we are
> >> duplicating all members of struct mtk_plane_state: switch to kmalloc
> >> to save some overhead.
> >
> > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> >
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >>   drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
>
> Hello,
>
> this series was sent and reviewed two months ago, but it hasn't been picked
> in any maintainer tree.
>
> This is a friendly ping to not let these two patches to be lost and forgotten.

For this series, applied to mediatek-drm-next [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Cheers,
> Angelo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-03-16 15:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 13:37 [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state AngeloGioacchino Del Regno
2022-01-18 13:37 ` [PATCH 2/2] drm: mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state AngeloGioacchino Del Regno
2022-01-25 16:37   ` Chun-Kuang Hu
2022-01-25 16:36 ` [PATCH 1/2] drm: mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state Chun-Kuang Hu
2022-03-16 10:40   ` AngeloGioacchino Del Regno
2022-03-16 15:12     ` Chun-Kuang Hu

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).