diff options
author | Hugh Dickins <hughd@google.com> | 2012-01-12 20:19:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:10 -0500 |
commit | 90b3feaec8ffb167abd8903bf111605c2f035aa8 (patch) | |
tree | 503c27c343397e1c94dce61e922fae18c7cd7172 /mm | |
parent | 12d27107867fc7216e8faaff0b894b0f162dcf75 (diff) |
memcg: fix mem_cgroup_print_bad_page
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>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9f2f64697409..602207be9853 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3364,23 +3364,8 @@ void mem_cgroup_print_bad_page(struct page *page) | |||
3364 | 3364 | ||
3365 | pc = lookup_page_cgroup_used(page); | 3365 | pc = lookup_page_cgroup_used(page); |
3366 | if (pc) { | 3366 | if (pc) { |
3367 | int ret = -1; | 3367 | printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p\n", |
3368 | char *path; | ||
3369 | |||
3370 | printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p", | ||
3371 | pc, pc->flags, pc->mem_cgroup); | 3368 | pc, pc->flags, pc->mem_cgroup); |
3372 | |||
3373 | path = kmalloc(PATH_MAX, GFP_KERNEL); | ||
3374 | if (path) { | ||
3375 | rcu_read_lock(); | ||
3376 | ret = cgroup_path(pc->mem_cgroup->css.cgroup, | ||
3377 | path, PATH_MAX); | ||
3378 | rcu_read_unlock(); | ||
3379 | } | ||
3380 | |||
3381 | printk(KERN_CONT "(%s)\n", | ||
3382 | (ret < 0) ? "cannot get the path" : path); | ||
3383 | kfree(path); | ||
3384 | } | 3369 | } |
3385 | } | 3370 | } |
3386 | #endif | 3371 | #endif |