|
@@ -679,7 +679,9 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
|
|
&src_mm->mmlist);
|
|
&src_mm->mmlist);
|
|
spin_unlock(&mmlist_lock);
|
|
spin_unlock(&mmlist_lock);
|
|
}
|
|
}
|
|
- if (is_write_migration_entry(entry) &&
|
|
|
|
|
|
+ if (likely(!non_swap_entry(entry)))
|
|
|
|
+ rss[MM_SWAPENTS]++;
|
|
|
|
+ else if (is_write_migration_entry(entry) &&
|
|
is_cow_mapping(vm_flags)) {
|
|
is_cow_mapping(vm_flags)) {
|
|
/*
|
|
/*
|
|
* COW mappings require pages in both parent
|
|
* COW mappings require pages in both parent
|
|
@@ -974,9 +976,14 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
|
|
if (pte_file(ptent)) {
|
|
if (pte_file(ptent)) {
|
|
if (unlikely(!(vma->vm_flags & VM_NONLINEAR)))
|
|
if (unlikely(!(vma->vm_flags & VM_NONLINEAR)))
|
|
print_bad_pte(vma, addr, ptent, NULL);
|
|
print_bad_pte(vma, addr, ptent, NULL);
|
|
- } else if
|
|
|
|
- (unlikely(!free_swap_and_cache(pte_to_swp_entry(ptent))))
|
|
|
|
- print_bad_pte(vma, addr, ptent, NULL);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ swp_entry_t entry = pte_to_swp_entry(ptent);
|
|
|
|
+
|
|
|
|
+ if (!non_swap_entry(entry))
|
|
|
|
+ rss[MM_SWAPENTS]--;
|
|
|
|
+ if (unlikely(!free_swap_and_cache(entry)))
|
|
|
|
+ print_bad_pte(vma, addr, ptent, NULL);
|
|
|
|
+ }
|
|
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
|
|
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
|
|
} while (pte++, addr += PAGE_SIZE, (addr != end && *zap_work > 0));
|
|
} while (pte++, addr += PAGE_SIZE, (addr != end && *zap_work > 0));
|
|
|
|
|
|
@@ -2692,6 +2699,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
|
|
*/
|
|
*/
|
|
|
|
|
|
inc_mm_counter_fast(mm, MM_ANONPAGES);
|
|
inc_mm_counter_fast(mm, MM_ANONPAGES);
|
|
|
|
+ dec_mm_counter_fast(mm, MM_SWAPENTS);
|
|
pte = mk_pte(page, vma->vm_page_prot);
|
|
pte = mk_pte(page, vma->vm_page_prot);
|
|
if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) {
|
|
if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) {
|
|
pte = maybe_mkwrite(pte_mkdirty(pte), vma);
|
|
pte = maybe_mkwrite(pte_mkdirty(pte), vma);
|