KAMEZAWA Hiroyuki e8589cc189 memcg: better migration handling
This patch changes page migration under memory controller to use a
different algorithm.  (thanks to Christoph for new idea.)

Before:
 - page_cgroup is migrated from an old page to a new page.
After:
 - a new page is accounted , no reuse of page_cgroup.

Pros:

 - We can avoid compliated lock depndencies and races in migration.

Cons:

 - new param to mem_cgroup_charge_common().

 - mem_cgroup_getref() is added for handling ref_cnt ping-pong.

This version simplifies complicated lock dependency in page migraiton
under memory resource controller.

  new refcnt sequence is following.

a mapped page:
  prepage_migration() ..... +1 to NEW page
  try_to_unmap()      ..... all refs to OLD page is gone.
  move_pages()        ..... +1 to NEW page if page cache.
  remap...            ..... all refs from *map* is added to NEW one.
  end_migration()     ..... -1 to New page.

  page's mapcount + (page_is_cache) refs are added to NEW one.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:37 -07:00
..
2008-03-19 18:53:35 -07:00
2008-07-19 22:39:46 -07:00
2008-07-24 10:47:17 -07:00
2008-07-25 10:53:37 -07:00
2008-07-24 10:47:18 -07:00
2007-10-20 01:27:18 +02:00
2008-07-25 10:53:37 -07:00
2008-04-28 08:58:18 -07:00
2008-07-24 10:47:17 -07:00
2007-10-18 14:37:31 -07:00
2007-05-21 09:18:19 -07:00
2008-02-05 09:44:19 -08:00
2008-06-12 18:05:41 -07:00
2007-10-20 01:27:18 +02:00
2008-04-28 08:58:18 -07:00
2008-07-24 10:47:16 -07:00
2008-07-04 10:40:04 -07:00
2007-11-14 18:45:41 -08:00
2008-07-24 10:47:17 -07:00
2008-07-24 10:47:14 -07:00