aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/swap.h
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2011-06-15 18:08:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-06-15 23:03:59 -0400
commita433658c30974fc87ba3ff52d7e4e6299762aa3d (patch)
tree8df65e22af520ca5c020281763e6874d0bb51bc5 /include/linux/swap.h
parente1bbd19bc4afef7adb80cca163800391c4f5773d (diff)
vmscan,memcg: memcg aware swap token
Currently, memcg reclaim can disable swap token even if the swap token mm doesn't belong in its memory cgroup. It's slightly risky. If an admin creates very small mem-cgroup and silly guy runs contentious heavy memory pressure workload, every tasks are going to lose swap token and then system may become unresponsive. That's bad. This patch adds 'memcg' parameter into disable_swap_token(). and if the parameter doesn't match swap token, VM doesn't disable it. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Rik van Riel<riel@redhat.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.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 384eb5fe530b..e70564647039 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -358,6 +358,7 @@ struct backing_dev_info;
358extern struct mm_struct *swap_token_mm; 358extern struct mm_struct *swap_token_mm;
359extern void grab_swap_token(struct mm_struct *); 359extern void grab_swap_token(struct mm_struct *);
360extern void __put_swap_token(struct mm_struct *); 360extern void __put_swap_token(struct mm_struct *);
361extern void disable_swap_token(struct mem_cgroup *memcg);
361 362
362static inline int has_swap_token(struct mm_struct *mm) 363static inline int has_swap_token(struct mm_struct *mm)
363{ 364{
@@ -370,11 +371,6 @@ static inline void put_swap_token(struct mm_struct *mm)
370 __put_swap_token(mm); 371 __put_swap_token(mm);
371} 372}
372 373
373static inline void disable_swap_token(void)
374{
375 put_swap_token(swap_token_mm);
376}
377
378#ifdef CONFIG_CGROUP_MEM_RES_CTLR 374#ifdef CONFIG_CGROUP_MEM_RES_CTLR
379extern void 375extern void
380mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); 376mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
@@ -500,7 +496,7 @@ static inline int has_swap_token(struct mm_struct *mm)
500 return 0; 496 return 0;
501} 497}
502 498
503static inline void disable_swap_token(void) 499static inline void disable_swap_token(struct mem_cgroup *memcg)
504{ 500{
505} 501}
506 502