memcg: move charge swapin under lock
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Sun, 19 Oct 2008 03:28:08 +0000 (20:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 15:52:38 +0000 (08:52 -0700)
commit073e587ec2cc377867e53d8b8959738a8e16cff6
tree856aac72b818de4f52ce38448b852930554b3efa
parent47c59803becb55b72b26cdab3838d621a15badc8
memcg: move charge swapin under lock

While page-cache's charge/uncharge is done under page_lock(), swap-cache
isn't.  (anonymous page is charged when it's newly allocated.)

This patch moves do_swap_page()'s charge() call under lock.  I don't see
any bad problem *now* but this fix will be good for future for avoiding
unnecessary racy state.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c