diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2011-06-15 18:08:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-15 23:03:59 -0400 |
commit | a433658c30974fc87ba3ff52d7e4e6299762aa3d (patch) | |
tree | 8df65e22af520ca5c020281763e6874d0bb51bc5 /mm/memcontrol.c | |
parent | e1bbd19bc4afef7adb80cca163800391c4f5773d (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 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index bd9052a5d3ad..e37c44d88d46 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -735,7 +735,7 @@ struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p) | |||
735 | struct mem_cgroup, css); | 735 | struct mem_cgroup, css); |
736 | } | 736 | } |
737 | 737 | ||
738 | static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm) | 738 | struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm) |
739 | { | 739 | { |
740 | struct mem_cgroup *mem = NULL; | 740 | struct mem_cgroup *mem = NULL; |
741 | 741 | ||
@@ -5414,18 +5414,16 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, | |||
5414 | struct cgroup *old_cont, | 5414 | struct cgroup *old_cont, |
5415 | struct task_struct *p) | 5415 | struct task_struct *p) |
5416 | { | 5416 | { |
5417 | struct mm_struct *mm; | 5417 | struct mm_struct *mm = get_task_mm(p); |
5418 | 5418 | ||
5419 | if (!mc.to) | ||
5420 | /* no need to move charge */ | ||
5421 | return; | ||
5422 | |||
5423 | mm = get_task_mm(p); | ||
5424 | if (mm) { | 5419 | if (mm) { |
5425 | mem_cgroup_move_charge(mm); | 5420 | if (mc.to) |
5421 | mem_cgroup_move_charge(mm); | ||
5422 | put_swap_token(mm); | ||
5426 | mmput(mm); | 5423 | mmput(mm); |
5427 | } | 5424 | } |
5428 | mem_cgroup_clear_mc(); | 5425 | if (mc.to) |
5426 | mem_cgroup_clear_mc(); | ||
5429 | } | 5427 | } |
5430 | #else /* !CONFIG_MMU */ | 5428 | #else /* !CONFIG_MMU */ |
5431 | static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | 5429 | static int mem_cgroup_can_attach(struct cgroup_subsys *ss, |