linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org
Subject: [PATCH 4/4] memcg: fix mem_cgroup_print_bad_page
Date: Wed, 28 Dec 2011 16:26:02 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.00.1112281623400.8257@eggly.anvils> (raw)
In-Reply-To: <alpine.LSU.2.00.1112281613550.8257@eggly.anvils>

If DEBUG_VM, mem_cgroup_print_bad_page() is called whenever bad_page()
shows a "Bad page state" message, removes page from circulation, adds a
taint and continues.  This is at a very low level, often when a spinlock
is held (sometimes when page table lock is held, for example).

We want to recover from this badness, not make it worse: we must not
kmalloc memory here, we must not do a cgroup path lookup via dubious
pointers.  No doubt that code was useful to debug a particular case
at one time, and may be again, but take it out of the mainline kernel.

Signed-off-by: Hugh Dickins <hughd@google.com>
---
This goes back to 2.6.39; but it is under DEBUG_VM, so probably
doesn't need Cc stable.

 mm/memcontrol.c |   17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

--- mmotm.orig/mm/memcontrol.c	2011-12-28 14:41:19.803018025 -0800
+++ mmotm/mm/memcontrol.c	2011-12-28 15:07:26.887055270 -0800
@@ -3369,23 +3369,8 @@ void mem_cgroup_print_bad_page(struct pa
 
 	pc = lookup_page_cgroup_used(page);
 	if (pc) {
-		int ret = -1;
-		char *path;
-
-		printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p",
+		printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p\n",
 		       pc, pc->flags, pc->mem_cgroup);
-
-		path = kmalloc(PATH_MAX, GFP_KERNEL);
-		if (path) {
-			rcu_read_lock();
-			ret = cgroup_path(pc->mem_cgroup->css.cgroup,
-							path, PATH_MAX);
-			rcu_read_unlock();
-		}
-
-		printk(KERN_CONT "(%s)\n",
-				(ret < 0) ? "cannot get the path" : path);
-		kfree(path);
 	}
 }
 #endif

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-12-29  0:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29  0:17 [PATCH 0/4] memcg: four fixes to current next Hugh Dickins
2011-12-29  0:20 ` [PATCH 1/4] memcg: fix split_huge_page_refcounts Hugh Dickins
2012-01-05  5:55   ` KAMEZAWA Hiroyuki
2011-12-29  0:21 ` [PATCH 2/4] memcg: fix NULL mem_cgroup_try_charge Hugh Dickins
2012-01-05  5:56   ` KAMEZAWA Hiroyuki
2011-12-29  0:23 ` [PATCH 3/4] memcg: fix page migration to reset_owner Hugh Dickins
2012-01-05  6:00   ` KAMEZAWA Hiroyuki
2011-12-29  0:26 ` Hugh Dickins [this message]
2012-01-05  6:01   ` [PATCH 4/4] memcg: fix mem_cgroup_print_bad_page KAMEZAWA Hiroyuki

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=alpine.LSU.2.00.1112281623400.8257@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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