diff options
author | Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | 2010-08-10 21:02:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:18 -0400 |
commit | bd0d24bfe8a8f8d2400569740874a67d164d40a9 (patch) | |
tree | 9d592f6566adacc3e8da3d2c06411a16b2d45763 /mm | |
parent | 2bd9bb206b338888b226e70139a25a67d10007f0 (diff) |
memcg: remove redundant code
- try_get_mem_cgroup_from_mm() calls rcu_read_lock/unlock by itself, so we
don't have to call them in task_in_mem_cgroup().
- *mz is not used in __mem_cgroup_uncharge_common().
- we don't have to call lookup_page_cgroup() in mem_cgroup_end_migration()
after we've cleared PCG_MIGRATION of @oldpage.
- remove empty comment.
- remove redundant empty line in mem_cgroup_cache_charge().
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 27981e705b0a..79a53f0f0cf5 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -840,9 +840,7 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem) | |||
840 | struct mem_cgroup *curr = NULL; | 840 | struct mem_cgroup *curr = NULL; |
841 | 841 | ||
842 | task_lock(task); | 842 | task_lock(task); |
843 | rcu_read_lock(); | ||
844 | curr = try_get_mem_cgroup_from_mm(task->mm); | 843 | curr = try_get_mem_cgroup_from_mm(task->mm); |
845 | rcu_read_unlock(); | ||
846 | task_unlock(task); | 844 | task_unlock(task); |
847 | if (!curr) | 845 | if (!curr) |
848 | return 0; | 846 | return 0; |
@@ -2092,7 +2090,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | |||
2092 | if (!(gfp_mask & __GFP_WAIT)) { | 2090 | if (!(gfp_mask & __GFP_WAIT)) { |
2093 | struct page_cgroup *pc; | 2091 | struct page_cgroup *pc; |
2094 | 2092 | ||
2095 | |||
2096 | pc = lookup_page_cgroup(page); | 2093 | pc = lookup_page_cgroup(page); |
2097 | if (!pc) | 2094 | if (!pc) |
2098 | return 0; | 2095 | return 0; |
@@ -2286,7 +2283,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype) | |||
2286 | { | 2283 | { |
2287 | struct page_cgroup *pc; | 2284 | struct page_cgroup *pc; |
2288 | struct mem_cgroup *mem = NULL; | 2285 | struct mem_cgroup *mem = NULL; |
2289 | struct mem_cgroup_per_zone *mz; | ||
2290 | 2286 | ||
2291 | if (mem_cgroup_disabled()) | 2287 | if (mem_cgroup_disabled()) |
2292 | return NULL; | 2288 | return NULL; |
@@ -2340,7 +2336,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype) | |||
2340 | * special functions. | 2336 | * special functions. |
2341 | */ | 2337 | */ |
2342 | 2338 | ||
2343 | mz = page_cgroup_zoneinfo(pc); | ||
2344 | unlock_page_cgroup(pc); | 2339 | unlock_page_cgroup(pc); |
2345 | 2340 | ||
2346 | memcg_check_events(mem, page); | 2341 | memcg_check_events(mem, page); |
@@ -2652,11 +2647,8 @@ void mem_cgroup_end_migration(struct mem_cgroup *mem, | |||
2652 | ClearPageCgroupMigration(pc); | 2647 | ClearPageCgroupMigration(pc); |
2653 | unlock_page_cgroup(pc); | 2648 | unlock_page_cgroup(pc); |
2654 | 2649 | ||
2655 | if (unused != oldpage) | ||
2656 | pc = lookup_page_cgroup(unused); | ||
2657 | __mem_cgroup_uncharge_common(unused, MEM_CGROUP_CHARGE_TYPE_FORCE); | 2650 | __mem_cgroup_uncharge_common(unused, MEM_CGROUP_CHARGE_TYPE_FORCE); |
2658 | 2651 | ||
2659 | pc = lookup_page_cgroup(used); | ||
2660 | /* | 2652 | /* |
2661 | * If a page is a file cache, radix-tree replacement is very atomic | 2653 | * If a page is a file cache, radix-tree replacement is very atomic |
2662 | * and we can skip this check. When it was an Anon page, its mapcount | 2654 | * and we can skip this check. When it was an Anon page, its mapcount |
@@ -3800,8 +3792,6 @@ static int mem_cgroup_oom_control_read(struct cgroup *cgrp, | |||
3800 | return 0; | 3792 | return 0; |
3801 | } | 3793 | } |
3802 | 3794 | ||
3803 | /* | ||
3804 | */ | ||
3805 | static int mem_cgroup_oom_control_write(struct cgroup *cgrp, | 3795 | static int mem_cgroup_oom_control_write(struct cgroup *cgrp, |
3806 | struct cftype *cft, u64 val) | 3796 | struct cftype *cft, u64 val) |
3807 | { | 3797 | { |