Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display/dml2: use vzalloc rather than kzalloc

The structures are large and they do not require contiguous
memory so use vzalloc.

Fixes: 70839da63605 ("drm/amd/display: Add new DCN401 sources")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4126
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+10 -7
+6 -5
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
··· 2 2 // 3 3 // Copyright 2024 Advanced Micro Devices, Inc. 4 4 5 + #include <linux/vmalloc.h> 5 6 6 7 #include "dml2_internal_types.h" 7 8 #include "dml_top.h" ··· 14 13 15 14 static bool dml21_allocate_memory(struct dml2_context **dml_ctx) 16 15 { 17 - *dml_ctx = kzalloc(sizeof(struct dml2_context), GFP_KERNEL); 16 + *dml_ctx = vzalloc(sizeof(struct dml2_context)); 18 17 if (!(*dml_ctx)) 19 18 return false; 20 19 21 - (*dml_ctx)->v21.dml_init.dml2_instance = kzalloc(sizeof(struct dml2_instance), GFP_KERNEL); 20 + (*dml_ctx)->v21.dml_init.dml2_instance = vzalloc(sizeof(struct dml2_instance)); 22 21 if (!((*dml_ctx)->v21.dml_init.dml2_instance)) 23 22 return false; 24 23 ··· 28 27 (*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config; 29 28 (*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config; 30 29 31 - (*dml_ctx)->v21.mode_programming.programming = kzalloc(sizeof(struct dml2_display_cfg_programming), GFP_KERNEL); 30 + (*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct dml2_display_cfg_programming)); 32 31 if (!((*dml_ctx)->v21.mode_programming.programming)) 33 32 return false; 34 33 ··· 116 115 117 116 void dml21_destroy(struct dml2_context *dml2) 118 117 { 119 - kfree(dml2->v21.dml_init.dml2_instance); 120 - kfree(dml2->v21.mode_programming.programming); 118 + vfree(dml2->v21.dml_init.dml2_instance); 119 + vfree(dml2->v21.mode_programming.programming); 121 120 } 122 121 123 122 static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
+4 -2
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
··· 24 24 * 25 25 */ 26 26 27 + #include <linux/vmalloc.h> 28 + 27 29 #include "display_mode_core.h" 28 30 #include "dml2_internal_types.h" 29 31 #include "dml2_utils.h" ··· 752 750 753 751 static inline struct dml2_context *dml2_allocate_memory(void) 754 752 { 755 - return (struct dml2_context *) kzalloc(sizeof(struct dml2_context), GFP_KERNEL); 753 + return (struct dml2_context *) vzalloc(sizeof(struct dml2_context)); 756 754 } 757 755 758 756 static void dml2_init(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2) ··· 826 824 827 825 if (dml2->architecture == dml2_architecture_21) 828 826 dml21_destroy(dml2); 829 - kfree(dml2); 827 + vfree(dml2); 830 828 } 831 829 832 830 void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,