[Freedreno] [PATCH 06/13] drm/msm: Use kzalloc for submit struct allocation
Jordan Crouse
jcrouse at codeaurora.org
Mon Oct 1 18:13:59 UTC 2018
On Mon, Oct 01, 2018 at 06:01:38PM +0530, Sharat Masetty wrote:
> This patch changes to kzalloc and avoids setting individual submit
> struct fields to zero manually.
I don't think this one is worth it. There are so many members in submit and so
few that get reset to 0 - I don't think the extra cycles are worth it in this
fast path.
> Signed-off-by: Sharat Masetty <smasetty at codeaurora.org>
> ---
> drivers/gpu/drm/msm/msm_gem_submit.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index a7c8cbc..7931c2a 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -41,24 +41,19 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
> if (sz > SIZE_MAX)
> return NULL;
>
> - submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
> + submit = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
> if (!submit)
> return NULL;
>
> submit->dev = dev;
> submit->gpu = gpu;
> submit->ctx = ctx;
> - submit->hw_fence = NULL;
> submit->out_fence_id = -1;
> submit->pid = get_pid(task_pid(current));
> submit->cmd = (void *)&submit->bos[nr_bos];
> submit->queue = queue;
> submit->ring = gpu->rb[queue->prio];
>
> - /* initially, until copy_from_user() and bo lookup succeeds: */
> - submit->nr_bos = 0;
> - submit->nr_cmds = 0;
> -
> INIT_LIST_HEAD(&submit->node);
> INIT_LIST_HEAD(&submit->bo_list);
> ww_acquire_init(&submit->ticket, &reservation_ww_class);
> --
> 1.9.1
>
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
More information about the Freedreno
mailing list