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>
This commit is contained in:

committed by
Linus Torvalds

parent
b830ac1d9a
commit
1f4c025b5a
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
|
||||
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
|
||||
gfp_t gfp_mask, nodemask_t *mask);
|
||||
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
|
||||
gfp_t gfp_mask, bool noswap,
|
||||
unsigned int swappiness);
|
||||
gfp_t gfp_mask, bool noswap);
|
||||
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
|
||||
gfp_t gfp_mask, bool noswap,
|
||||
unsigned int swappiness,
|
||||
struct zone *zone,
|
||||
unsigned long *nr_scanned);
|
||||
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)
|
||||
|
||||
extern int kswapd_run(int nid);
|
||||
extern void kswapd_stop(int nid);
|
||||
|
||||
#ifdef CONFIG_CGROUP_MEM_RES_CTLR
|
||||
extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
|
||||
#else
|
||||
static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
|
||||
{
|
||||
return vm_swappiness;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_SWAP
|
||||
/* linux/mm/page_io.c */
|
||||
extern int swap_readpage(struct page *);
|
||||
|
Reference in New Issue
Block a user