memory-hotplug: move pgdat_resize_lock into sparse_remove_one_section()
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / mm / memory.c
index bb1369f7b9b4ba8af51d90a40de8f522aa2470dc..7837ceacf0903774a740021d90423733aba7c57c 100644 (file)
@@ -3044,7 +3044,10 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
        }
        flush_icache_page(vma, page);
        set_pte_at(mm, address, page_table, pte);
-       do_page_add_anon_rmap(page, vma, address, exclusive);
+       if (swapcache) /* ksm created a completely new copy */
+               page_add_new_anon_rmap(page, vma, address);
+       else
+               do_page_add_anon_rmap(page, vma, address, exclusive);
        /* It's better to call commit-charge after rmap is established */
        mem_cgroup_commit_charge_swapin(page, ptr);
 
@@ -3821,30 +3824,6 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
 }
 #endif /* __PAGETABLE_PMD_FOLDED */
 
-int make_pages_present(unsigned long addr, unsigned long end)
-{
-       int ret, len, write;
-       struct vm_area_struct * vma;
-
-       vma = find_vma(current->mm, addr);
-       if (!vma)
-               return -ENOMEM;
-       /*
-        * We want to touch writable mappings with a write fault in order
-        * to break COW, except for shared mappings because these don't COW
-        * and we would not want to dirty them for nothing.
-        */
-       write = (vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE;
-       BUG_ON(addr >= end);
-       BUG_ON(end > vma->vm_end);
-       len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
-       ret = get_user_pages(current, current->mm, addr,
-                       len, write, 0, NULL, NULL);
-       if (ret < 0)
-               return ret;
-       return ret == len ? 0 : -EFAULT;
-}
-
 #if !defined(__HAVE_ARCH_GATE_AREA)
 
 #if defined(AT_SYSINFO_EHDR)