diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-07-26 19:08:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:42 -0400 |
commit | 1f4c025b5a5520fd2571244196b1b01ad96d18f6 (patch) | |
tree | f2123a44c9e838eac7d08fe13443cfa04cc23f33 /include | |
parent | b830ac1d9a2262093bb0f3f6a2fd2a1c8278daf5 (diff) |
memcg: export memory cgroup's swappiness with mem_cgroup_swappiness()
Each memory cgroup has a 'swappiness' value which can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness() is a static function but some planned updates will need
to get swappiness from files other than memcontrol.c This patch exports
get_swappiness() as mem_cgroup_swappiness(). With this, we can remove the
argument of swapiness from try_to_free... and drop swappiness from
scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Ying Han <yinghan@google.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/swap.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index a273468f8285..44558b600ee3 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page) | |||
252 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 252 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
253 | gfp_t gfp_mask, nodemask_t *mask); | 253 | gfp_t gfp_mask, nodemask_t *mask); |
254 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | 254 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, |
255 | gfp_t gfp_mask, bool noswap, | 255 | gfp_t gfp_mask, bool noswap); |
256 | unsigned int swappiness); | ||
257 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | 256 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, |
258 | gfp_t gfp_mask, bool noswap, | 257 | gfp_t gfp_mask, bool noswap, |
259 | unsigned int swappiness, | ||
260 | struct zone *zone, | 258 | struct zone *zone, |
261 | unsigned long *nr_scanned); | 259 | unsigned long *nr_scanned); |
262 | extern int __isolate_lru_page(struct page *page, int mode, int file); | 260 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
@@ -299,7 +297,14 @@ static inline void scan_unevictable_unregister_node(struct node *node) | |||
299 | 297 | ||
300 | extern int kswapd_run(int nid); | 298 | extern int kswapd_run(int nid); |
301 | extern void kswapd_stop(int nid); | 299 | extern void kswapd_stop(int nid); |
302 | 300 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | |
301 | extern int mem_cgroup_swappiness(struct mem_cgroup *mem); | ||
302 | #else | ||
303 | static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | ||
304 | { | ||
305 | return vm_swappiness; | ||
306 | } | ||
307 | #endif | ||
303 | #ifdef CONFIG_SWAP | 308 | #ifdef CONFIG_SWAP |
304 | /* linux/mm/page_io.c */ | 309 | /* linux/mm/page_io.c */ |
305 | extern int swap_readpage(struct page *); | 310 | extern int swap_readpage(struct page *); |