diff options
author | Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | 2010-05-26 17:42:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:43 -0400 |
commit | 87946a72283be3de936adc754b7007df7d3e6aeb (patch) | |
tree | 0593c87ba36bae13d6a6d5dda65ebb41354954f8 /include/linux/swap.h | |
parent | 90254a65833b67502d14736410b3857a15535c67 (diff) |
memcg: move charge of file pages
This patch adds support for moving charge of file pages, which include
normal file, tmpfs file and swaps of tmpfs file. It's enabled by setting
bit 1 of <target cgroup>/memory.move_charge_at_immigrate.
Unlike the case of anonymous pages, file pages(and swaps) in the range
mmapped by the task will be moved even if the task hasn't done page fault,
i.e. they might not be the task's "RSS", but other task's "RSS" that maps
the same file. And mapcount of the page is ignored(the page can be moved
even if page_mapcount(page) > 1). So, conditions that the page/swap
should be met to be moved is that it must be in the range mmapped by the
target task and it must be charged to the old cgroup.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix warning]
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index b6b614364dd8..ff4acea9bbdb 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -282,6 +282,11 @@ extern void kswapd_stop(int nid); | |||
282 | extern int shmem_unuse(swp_entry_t entry, struct page *page); | 282 | extern int shmem_unuse(swp_entry_t entry, struct page *page); |
283 | #endif /* CONFIG_MMU */ | 283 | #endif /* CONFIG_MMU */ |
284 | 284 | ||
285 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
286 | extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff, | ||
287 | struct page **pagep, swp_entry_t *ent); | ||
288 | #endif | ||
289 | |||
285 | extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); | 290 | extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); |
286 | 291 | ||
287 | #ifdef CONFIG_SWAP | 292 | #ifdef CONFIG_SWAP |