Files
linux-legacy/include/linux
KAMEZAWA Hiroyuki d13d144309 memcg: handle swap caches
SwapCache support for memory resource controller (memcg)

Before mem+swap controller, memcg itself should handle SwapCache in proper
way.  This is cut-out from it.

In current memcg, SwapCache is just leaked and the user can create tons of
SwapCache.  This is a leak of account and should be handled.

SwapCache accounting is done as following.

  charge (anon)
	- charged when it's mapped.
	  (because of readahead, charge at add_to_swap_cache() is not sane)
  uncharge (anon)
	- uncharged when it's dropped from swapcache and fully unmapped.
	  means it's not uncharged at unmap.
	  Note: delete from swap cache at swap-in is done after rmap information
	        is established.
  charge (shmem)
	- charged at swap-in. this prevents charge at add_to_page_cache().

  uncharge (shmem)
	- uncharged when it's dropped from swapcache and not on shmem's
	  radix-tree.

  at migration, check against 'old page' is modified to handle shmem.

Comparing to the old version discussed (and caused troubles), we have
advantages of
  - PCG_USED bit.
  - simple migrating handling.

So, situation is much easier than several months ago, maybe.

[hugh@veritas.com: memcg: handle swap caches build fix]
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Tested-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-08 08:31:05 -08:00
..
…
…
…
…
2009-01-04 12:17:42 +01:00
…
2009-01-07 17:38:32 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
2008-12-29 08:29:50 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-06 15:59:29 -08:00
2009-01-01 10:12:19 +10:30
…
2008-12-29 08:29:50 +01:00
…
2009-01-04 13:33:20 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-08 08:31:03 -08:00
…
…
…
…
…
…
2009-01-02 12:19:34 -08:00
…
2008-12-29 17:47:23 +10:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2008-12-31 18:07:38 -05:00
…
…
…
…
…
…
…
…
…
…
2008-12-29 07:39:34 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2008-12-29 11:27:46 +02:00
…
…
…
…
…
…
…
…
…
…
2008-12-31 18:07:42 -05:00
…
…
…
…
2009-01-06 15:59:01 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-07 14:29:17 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2008-12-31 18:07:42 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-05 08:40:30 -08:00
2009-01-08 08:31:00 -08:00
…
…
…
2009-01-05 08:40:30 -08:00
…
…
…
…
2008-12-31 15:11:46 +01:00
…
…
…
…
…
…
…
…
…
…
…
2009-01-03 14:11:07 +01:00
…
…
…
…
2008-12-28 22:43:21 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-08 08:31:04 -08:00
…
…
…
…
…
2009-01-06 15:58:58 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-04 16:13:40 -08:00
…
…
…
…
…
2009-01-07 17:38:31 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-06 10:44:30 -08:00
…
…
…
2009-01-06 15:59:12 -08:00
…
…
…
…
…
…
…
2009-01-05 18:31:12 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-04 13:33:20 -08:00
…
…
…
…
…
…
…
…
…
2009-01-07 09:58:22 +11:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2008-12-30 09:05:16 +10:30
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-08 08:31:05 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-01 10:12:25 +10:30
…
…
…
…
…
…
…
…
2009-01-02 10:19:36 -08:00
…
…
…
…
…
…
…
2009-01-07 10:00:14 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2009-01-06 15:59:09 -08:00
…
…
…
…
…
…
…
…