mm/rmap: use rmap_walk() in try_to_munlock()
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / ksm.c
index 6b4baa9..646d45a 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1946,56 +1946,6 @@ out:
        return referenced;
 }
 
-int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
-{
-       struct stable_node *stable_node;
-       struct rmap_item *rmap_item;
-       int ret = SWAP_AGAIN;
-       int search_new_forks = 0;
-
-       VM_BUG_ON(!PageKsm(page));
-       VM_BUG_ON(!PageLocked(page));
-
-       stable_node = page_stable_node(page);
-       if (!stable_node)
-               return SWAP_FAIL;
-again:
-       hlist_for_each_entry(rmap_item, &stable_node->hlist, hlist) {
-               struct anon_vma *anon_vma = rmap_item->anon_vma;
-               struct anon_vma_chain *vmac;
-               struct vm_area_struct *vma;
-
-               anon_vma_lock_read(anon_vma);
-               anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
-                                              0, ULONG_MAX) {
-                       vma = vmac->vma;
-                       if (rmap_item->address < vma->vm_start ||
-                           rmap_item->address >= vma->vm_end)
-                               continue;
-                       /*
-                        * Initially we examine only the vma which covers this
-                        * rmap_item; but later, if there is still work to do,
-                        * we examine covering vmas in other mms: in case they
-                        * were forked from the original since ksmd passed.
-                        */
-                       if ((rmap_item->mm == vma->vm_mm) == search_new_forks)
-                               continue;
-
-                       ret = try_to_unmap_one(page, vma,
-                                       rmap_item->address, (void *)flags);
-                       if (ret != SWAP_AGAIN || !page_mapped(page)) {
-                               anon_vma_unlock_read(anon_vma);
-                               goto out;
-                       }
-               }
-               anon_vma_unlock_read(anon_vma);
-       }
-       if (!search_new_forks++)
-               goto again;
-out:
-       return ret;
-}
-
 int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc)
 {
        struct stable_node *stable_node;