On Thu, Aug 8, 2019 at 4:13 AM Michel Dänzer <michel@xxxxxxxxxxx> wrote: > > On 2019-08-08 7:31 a.m., Alex Deucher wrote: > > On Wed, Aug 7, 2019 at 11:49 PM Mikhail Gavrilov > > <mikhail.v.gavrilov@xxxxxxxxx> wrote: > >> > >> Unfortunately error "gnome-shell: page allocation failure: order:4, > >> mode:0x40cc0(GFP_KERNEL|__GFP_COMP), > >> nodemask=(null),cpuset=/,mems_allowed=0" still happens even with > >> applying this patch. > > > > I think we can just drop the kmalloc altogether. How about this patch? > > Memory allocated by kvz/malloc needs to be freed with kvfree. > Yup, good catch. Updated patch attached. Alex
From 5c27c25ce79ac2b18a37bcd7dc6fa0bd3d8733d3 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@xxxxxxx> Date: Thu, 8 Aug 2019 00:29:23 -0500 Subject: [PATCH] drm/amd/display: use kvmalloc for dc_state (v2) It's large and doesn't need contiguous memory. v2: kvfree the memory. Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> --- drivers/gpu/drm/amd/display/dc/core/dc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 252b621d93a9..21fb7ee17c9c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -23,6 +23,7 @@ */ #include <linux/slab.h> +#include <linux/mm.h> #include "dm_services.h" @@ -1183,8 +1184,8 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) struct dc_state *dc_create_state(struct dc *dc) { - struct dc_state *context = kzalloc(sizeof(struct dc_state), - GFP_KERNEL); + struct dc_state *context = kvzalloc(sizeof(struct dc_state), + GFP_KERNEL); if (!context) return NULL; @@ -1204,11 +1205,11 @@ struct dc_state *dc_create_state(struct dc *dc) struct dc_state *dc_copy_state(struct dc_state *src_ctx) { int i, j; - struct dc_state *new_ctx = kmemdup(src_ctx, - sizeof(struct dc_state), GFP_KERNEL); + struct dc_state *new_ctx = kvmalloc(sizeof(struct dc_state), GFP_KERNEL); if (!new_ctx) return NULL; + memcpy(new_ctx, src_ctx, sizeof(struct dc_state)); for (i = 0; i < MAX_PIPES; i++) { struct pipe_ctx *cur_pipe = &new_ctx->res_ctx.pipe_ctx[i]; @@ -1242,7 +1243,7 @@ static void dc_state_free(struct kref *kref) { struct dc_state *context = container_of(kref, struct dc_state, refcount); dc_resource_state_destruct(context); - kfree(context); + kvfree(context); } void dc_release_state(struct dc_state *context) -- 2.20.1
_______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx