drm/amd/display/dml2: use vzalloc rather than kzalloc
Subsystems (3)
Alex Deucher
maintainerPATCH 1/1 drm/amd/display/dml2: use vzalloc rather than kzalloc
The structures are large and they do not require continuous memory so use vzalloc.
Fixes 70839da63605 ("drm/amd/display: Add new DCN401 sources")
Cc Aurabindo Pillai <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- .../gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 11 ++++++----- drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c +6 -5
@@ -2,6 +2,7 @@// // Copyright 2024 Advanced Micro Devices, Inc. +#include <linux/vmalloc.h> #include "dml2_internal_types.h" #include "dml_top.h"
@@ -13,11 +14,11 @@static bool dml21_allocate_memory (struct dml2_context **dml_ctx) { - *dml_ctx =kzalloc (sizeof (struct dml2_context ),GFP_KERNEL ); + *dml_ctx =vzalloc (sizeof (struct dml2_context ));if (!(*dml_ctx))return false; - (*dml_ctx)->v21.dml_init.dml2_instance =kzalloc (sizeof (struct dml2_instance ),GFP_KERNEL ); + (*dml_ctx)->v21.dml_init.dml2_instance =vzalloc (sizeof (struct dml2_instance ));if (!((*dml_ctx)->v21.dml_init.dml2_instance))return false;
@@ -27,7 +28,7 @@ static bool dml21_allocate_memory(struct dml2_context **dml_ctx) (*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config; (*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config; - (*dml_ctx)->v21.mode_programming.programming =kzalloc (sizeof (struct dml2_display_cfg_programming ),GFP_KERNEL ); + (*dml_ctx)->v21.mode_programming.programming =vzalloc (sizeof (struct dml2_display_cfg_programming ));if (!((*dml_ctx)->v21.mode_programming.programming))return false;
@@ -115,8 +116,8 @@ bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const svoid dml21_destroy (struct dml2_context *dml2) { -kfree (dml2->v21.dml_init.dml2_instance); -kfree (dml2->v21.mode_programming.programming); +vfree (dml2->v21.dml_init.dml2_instance); +vfree (dml2->v21.mode_programming.programming); } static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +4 -2
@@ -24,6 +24,8 @@* */ +#include <linux/vmalloc.h> +#include "display_mode_core.h" #include "dml2_internal_types.h" #include "dml2_utils.h"
@@ -750,7 +752,7 @@ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2static inline struct dml2_context *dml2_allocate_memory (void ) { -return (struct dml2_context *)kzalloc (sizeof (struct dml2_context ),GFP_KERNEL ); +return (struct dml2_context *)vzalloc (sizeof (struct dml2_context )); }static void dml2_init (const struct dc *in_dc,const struct dml2_configuration_options *config,struct dml2_context **dml2)
@@ -824,7 +826,7 @@ void dml2_destroy(struct dml2_context *dml2)if (dml2->architecture == dml2_architecture_21)dml21_destroy (dml2); -kfree (dml2); +vfree (dml2); } void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
Signature · 1 line
2.49.0
[AMD Official Use Only - AMD Internal Distribution Only]
Reviewed-by Aurabindo Pillai <[email protected]>
--
Regards,
Jay
________________________________
From: Deucher, Alexander <[email protected]>
Sent: Wednesday, April 9, 2025 5:41 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Pillai, Aurabindo <[email protected]>
Subject: [PATCH] drm/amd/display/dml2: use vzalloc rather than kzalloc
The structures are large and they do not require continuous memory so use vzalloc.
Fixes 70839da63605 ("drm/amd/display: Add new DCN401 sources")
Cc Aurabindo Pillai <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- .../gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 11 ++++++----- drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c +6 -5
@@ -2,6 +2,7 @@// // Copyright 2024 Advanced Micro Devices, Inc. +#include <linux/vmalloc.h> #include "dml2_internal_types.h" #include "dml_top.h"
@@ -13,11 +14,11 @@static bool dml21_allocate_memory (struct dml2_context **dml_ctx) { - *dml_ctx =kzalloc (sizeof (struct dml2_context ),GFP_KERNEL ); + *dml_ctx =vzalloc (sizeof (struct dml2_context ));if (!(*dml_ctx))return false; - (*dml_ctx)->v21.dml_init.dml2_instance =kzalloc (sizeof (struct dml2_instance ),GFP_KERNEL ); + (*dml_ctx)->v21.dml_init.dml2_instance =vzalloc (sizeof (struct dml2_instance ));if (!((*dml_ctx)->v21.dml_init.dml2_instance))return false;
@@ -27,7 +28,7 @@ static bool dml21_allocate_memory(struct dml2_context **dml_ctx) (*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config; (*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config; - (*dml_ctx)->v21.mode_programming.programming =kzalloc (sizeof (struct dml2_display_cfg_programming ),GFP_KERNEL ); + (*dml_ctx)->v21.mode_programming.programming =vzalloc (sizeof (struct dml2_display_cfg_programming ));if (!((*dml_ctx)->v21.mode_programming.programming))return false;
@@ -115,8 +116,8 @@ bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const svoid dml21_destroy (struct dml2_context *dml2) { -kfree (dml2->v21.dml_init.dml2_instance); -kfree (dml2->v21.mode_programming.programming); +vfree (dml2->v21.dml_init.dml2_instance); +vfree (dml2->v21.mode_programming.programming); } static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +4 -2
@@ -24,6 +24,8 @@* */ +#include <linux/vmalloc.h> +#include "display_mode_core.h" #include "dml2_internal_types.h" #include "dml2_utils.h"
@@ -750,7 +752,7 @@ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2static inline struct dml2_context *dml2_allocate_memory (void ) { -return (struct dml2_context *)kzalloc (sizeof (struct dml2_context ),GFP_KERNEL ); +return (struct dml2_context *)vzalloc (sizeof (struct dml2_context )); }static void dml2_init (const struct dc *in_dc,const struct dml2_configuration_options *config,struct dml2_context **dml2)
@@ -824,7 +826,7 @@ void dml2_destroy(struct dml2_context *dml2)if (dml2->architecture == dml2_architecture_21)dml21_destroy (dml2); -kfree (dml2); +vfree (dml2); } void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
--
2.49.0