Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memcg: fix mapcount check in move charge code for anonymous page

Currently the charge on shared anonyous pages is supposed not to moved in
task migration. To implement this, we need to check that mapcount > 1,
instread of > 2. So this patch fixes it.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Naoya Horiguchi and committed by
Linus Torvalds
e6ca7b89 1c641e84

+1 -1
+1 -1
mm/memcontrol.c
··· 5075 5075 return NULL; 5076 5076 if (PageAnon(page)) { 5077 5077 /* we don't move shared anon */ 5078 - if (!move_anon() || page_mapcount(page) > 2) 5078 + if (!move_anon() || page_mapcount(page) > 1) 5079 5079 return NULL; 5080 5080 } else if (!move_file()) 5081 5081 /* we ignore mapcount for file pages */