diff options
author | Hugh Dickins <hughd@google.com> | 2012-05-29 18:06:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:24 -0400 |
commit | e91cbb42531626cd4fd0673ca01daf53e338d8f9 (patch) | |
tree | a7138650c4a4914e539f3eeeb69e39d22dba4242 | |
parent | 4b91355e9dc9ac1eb3d69e56de093899ff2677ef (diff) |
memcg swap: mem_cgroup_move_swap_account never needs fixup
The need_fixup arg to mem_cgroup_move_swap_account() is always false,
so just remove it.
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/memcontrol.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e7db70f3d2d6..d5ba631e0ec7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3165,7 +3165,6 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent) | |||
3165 | * @entry: swap entry to be moved | 3165 | * @entry: swap entry to be moved |
3166 | * @from: mem_cgroup which the entry is moved from | 3166 | * @from: mem_cgroup which the entry is moved from |
3167 | * @to: mem_cgroup which the entry is moved to | 3167 | * @to: mem_cgroup which the entry is moved to |
3168 | * @need_fixup: whether we should fixup res_counters and refcounts. | ||
3169 | * | 3168 | * |
3170 | * It succeeds only when the swap_cgroup's record for this entry is the same | 3169 | * It succeeds only when the swap_cgroup's record for this entry is the same |
3171 | * as the mem_cgroup's id of @from. | 3170 | * as the mem_cgroup's id of @from. |
@@ -3176,7 +3175,7 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent) | |||
3176 | * both res and memsw, and called css_get(). | 3175 | * both res and memsw, and called css_get(). |
3177 | */ | 3176 | */ |
3178 | static int mem_cgroup_move_swap_account(swp_entry_t entry, | 3177 | static int mem_cgroup_move_swap_account(swp_entry_t entry, |
3179 | struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup) | 3178 | struct mem_cgroup *from, struct mem_cgroup *to) |
3180 | { | 3179 | { |
3181 | unsigned short old_id, new_id; | 3180 | unsigned short old_id, new_id; |
3182 | 3181 | ||
@@ -3195,24 +3194,13 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry, | |||
3195 | * swap-in, the refcount of @to might be decreased to 0. | 3194 | * swap-in, the refcount of @to might be decreased to 0. |
3196 | */ | 3195 | */ |
3197 | mem_cgroup_get(to); | 3196 | mem_cgroup_get(to); |
3198 | if (need_fixup) { | ||
3199 | if (!mem_cgroup_is_root(from)) | ||
3200 | res_counter_uncharge(&from->memsw, PAGE_SIZE); | ||
3201 | mem_cgroup_put(from); | ||
3202 | /* | ||
3203 | * we charged both to->res and to->memsw, so we should | ||
3204 | * uncharge to->res. | ||
3205 | */ | ||
3206 | if (!mem_cgroup_is_root(to)) | ||
3207 | res_counter_uncharge(&to->res, PAGE_SIZE); | ||
3208 | } | ||
3209 | return 0; | 3197 | return 0; |
3210 | } | 3198 | } |
3211 | return -EINVAL; | 3199 | return -EINVAL; |
3212 | } | 3200 | } |
3213 | #else | 3201 | #else |
3214 | static inline int mem_cgroup_move_swap_account(swp_entry_t entry, | 3202 | static inline int mem_cgroup_move_swap_account(swp_entry_t entry, |
3215 | struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup) | 3203 | struct mem_cgroup *from, struct mem_cgroup *to) |
3216 | { | 3204 | { |
3217 | return -EINVAL; | 3205 | return -EINVAL; |
3218 | } | 3206 | } |
@@ -5546,8 +5534,7 @@ put: /* get_mctgt_type() gets the page */ | |||
5546 | break; | 5534 | break; |
5547 | case MC_TARGET_SWAP: | 5535 | case MC_TARGET_SWAP: |
5548 | ent = target.ent; | 5536 | ent = target.ent; |
5549 | if (!mem_cgroup_move_swap_account(ent, | 5537 | if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) { |
5550 | mc.from, mc.to, false)) { | ||
5551 | mc.precharge--; | 5538 | mc.precharge--; |
5552 | /* we fixup refcnts and charges later. */ | 5539 | /* we fixup refcnts and charges later. */ |
5553 | mc.moved_swap++; | 5540 | mc.moved_swap++; |