Commit 90b3feaec8ffb167abd8903bf111605c2f035aa8

Authored by Hugh Dickins
Committed by Linus Torvalds
1 parent 12d2710786

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>

Showing 1 changed file with 1 additions and 16 deletions Side-by-side Diff

... ... @@ -3364,23 +3364,8 @@
3364 3364  
3365 3365 pc = lookup_page_cgroup_used(page);
3366 3366 if (pc) {
3367   - int ret = -1;
3368   - char *path;
3369   -
3370   - printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p",
  3367 + printk(KERN_ALERT "pc:%p pc->flags:%lx pc->mem_cgroup:%p\n",
3371 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 3371 #endif