mm: swapfile: clean up unuse_pte race handling
authorJohannes Weiner <[email protected]>
Tue, 31 Jul 2012 23:45:28 +0000 (16:45 -0700)
committerLinus Torvalds <[email protected]>
Wed, 1 Aug 2012 01:42:48 +0000 (18:42 -0700)
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 <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Wanpeng Li <[email protected]>
Cc: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/swapfile.c

index 63958d60ecb080728343c52f3728b4aebe93c5bd..14e254c768fc5090e9c2276085b3c6f96c6255f6 100644 (file)
@@ -835,8 +835,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
 
        pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
        if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) {
-               if (ret > 0)
-                       mem_cgroup_cancel_charge_swapin(memcg);
+               mem_cgroup_cancel_charge_swapin(memcg);
                ret = 0;
                goto out;
        }