Skip to content

Commit 5d84c77

Browse files
hnaztorvalds
authored andcommitted
mm: swapfile: clean up unuse_pte race handling
The conditional mem_cgroup_cancel_charge_swapin() is a leftover from when the function would continue to reestablish the page even after mem_cgroup_try_charge_swapin() failed. After 85d9fc8 "memcg: fix refcnt handling at swapoff", the condition is always true when this code is reached. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Wanpeng Li <liwp.linux@gmail.com> Cc: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0030f53 commit 5d84c77

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mm/swapfile.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
835835

836836
pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
837837
if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) {
838-
if (ret > 0)
839-
mem_cgroup_cancel_charge_swapin(memcg);
838+
mem_cgroup_cancel_charge_swapin(memcg);
840839
ret = 0;
841840
goto out;
842841
}

0 commit comments

Comments
 (0)