linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: "Michel Dänzer" <michel@daenzer.net>
Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>,
	Hillf Danton <hdanton@sina.com>,  Dave Airlie <airlied@gmail.com>,
	 Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	 "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	Harry Wentland <harry.wentland@amd.com>,
	 "Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: The issue with page allocation 5.3 rc1-rc2 (seems drm culprit here)
Date: Thu, 8 Aug 2019 10:26:20 -0400	[thread overview]
Message-ID: <CADnq5_P=gtz_8vNyV7At73PngbNS_-cyAnpd3aKGPUFyrK64EA@mail.gmail.com> (raw)
In-Reply-To: <6d5110ab-6539-378d-f643-0a1d4cf0ff73@daenzer.net>

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

On Thu, Aug 8, 2019 at 4:13 AM Michel Dänzer <michel@daenzer.net> 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@gmail.com> 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

[-- Attachment #2: 0001-drm-amd-display-use-kvmalloc-for-dc_state-v2.patch --]
[-- Type: text/x-patch, Size: 1915 bytes --]

From 5c27c25ce79ac2b18a37bcd7dc6fa0bd3d8733d3 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
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@amd.com>
---
 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


  reply	other threads:[~2019-08-08 14:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06  1:48 The issue with page allocation 5.3 rc1-rc2 (seems drm culprit here) Hillf Danton
2019-08-08  3:48 ` Mikhail Gavrilov
2019-08-08  5:31   ` Alex Deucher
2019-08-08  8:12     ` Michel Dänzer
2019-08-08 14:26       ` Alex Deucher [this message]
2019-08-09 18:55         ` Mikhail Gavrilov
2019-08-10 16:08           ` Mikhail Gavrilov
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  7:42 Hillf Danton
2019-08-05  3:21 Hillf Danton
2019-08-05 17:14 ` Mikhail Gavrilov
2019-08-04 22:23 Mikhail Gavrilov
2019-08-05  1:03 ` Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnq5_P=gtz_8vNyV7At73PngbNS_-cyAnpd3aKGPUFyrK64EA@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=michel@daenzer.net \
    --cc=mikhail.v.gavrilov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).