Commit e91cbb42 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

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: default avatarHugh Dickins <hughd@google.com>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4b91355e
...@@ -3165,7 +3165,6 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent) ...@@ -3165,7 +3165,6 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent)
* @entry: swap entry to be moved * @entry: swap entry to be moved
* @from: mem_cgroup which the entry is moved from * @from: mem_cgroup which the entry is moved from
* @to: mem_cgroup which the entry is moved to * @to: mem_cgroup which the entry is moved to
* @need_fixup: whether we should fixup res_counters and refcounts.
* *
* It succeeds only when the swap_cgroup's record for this entry is the same * It succeeds only when the swap_cgroup's record for this entry is the same
* as the mem_cgroup's id of @from. * as the mem_cgroup's id of @from.
...@@ -3176,7 +3175,7 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent) ...@@ -3176,7 +3175,7 @@ void mem_cgroup_uncharge_swap(swp_entry_t ent)
* both res and memsw, and called css_get(). * both res and memsw, and called css_get().
*/ */
static int mem_cgroup_move_swap_account(swp_entry_t entry, static int mem_cgroup_move_swap_account(swp_entry_t entry,
struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup) struct mem_cgroup *from, struct mem_cgroup *to)
{ {
unsigned short old_id, new_id; unsigned short old_id, new_id;
...@@ -3195,24 +3194,13 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry, ...@@ -3195,24 +3194,13 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
* swap-in, the refcount of @to might be decreased to 0. * swap-in, the refcount of @to might be decreased to 0.
*/ */
mem_cgroup_get(to); mem_cgroup_get(to);
if (need_fixup) {
if (!mem_cgroup_is_root(from))
res_counter_uncharge(&from->memsw, PAGE_SIZE);
mem_cgroup_put(from);
/*
* we charged both to->res and to->memsw, so we should
* uncharge to->res.
*/
if (!mem_cgroup_is_root(to))
res_counter_uncharge(&to->res, PAGE_SIZE);
}
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
#else #else
static inline int mem_cgroup_move_swap_account(swp_entry_t entry, static inline int mem_cgroup_move_swap_account(swp_entry_t entry,
struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup) struct mem_cgroup *from, struct mem_cgroup *to)
{ {
return -EINVAL; return -EINVAL;
} }
...@@ -5546,8 +5534,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, ...@@ -5546,8 +5534,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd,
break; break;
case MC_TARGET_SWAP: case MC_TARGET_SWAP:
ent = target.ent; ent = target.ent;
if (!mem_cgroup_move_swap_account(ent, if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
mc.from, mc.to, false)) {
mc.precharge--; mc.precharge--;
/* we fixup refcnts and charges later. */ /* we fixup refcnts and charges later. */
mc.moved_swap++; mc.moved_swap++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment