UPSTREAM: mm/ksm: Remove reuse_ksm_page()
authorPeter Xu <peterx@redhat.com>
Fri, 21 Aug 2020 23:49:56 +0000 (19:49 -0400)
committerTodd Kjos <tkjos@google.com>
Thu, 7 Jul 2022 02:21:25 +0000 (19:21 -0700)
Remove the function as the last reference has gone away with the do_wp_page()
changes.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 1a0cf26323c80e2f1c58fc04f15686de61bfab0c)

Bug: 176847924
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Change-Id: I70e5938a046d0fc449288ae46c83cb7c39d7de48

include/linux/ksm.h
mm/ksm.c

index def48a2d87aa90f28bcdc23ce32b0b32ab7852ee..44368b19b27e11e848ced6348c4e747396c23b6b 100644 (file)
@@ -64,8 +64,6 @@ struct page *ksm_might_need_to_copy(struct page *page,
 
 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
-bool reuse_ksm_page(struct page *page,
-                       struct vm_area_struct *vma, unsigned long address);
 
 #else  /* !CONFIG_KSM */
 
@@ -105,11 +103,6 @@ static inline void rmap_walk_ksm(struct page *page,
 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
 {
 }
-static inline bool reuse_ksm_page(struct page *page,
-                       struct vm_area_struct *vma, unsigned long address)
-{
-       return false;
-}
 #endif /* CONFIG_MMU */
 #endif /* !CONFIG_KSM */
 
index 60505a0c1142b0d00390f9ca8ebab35bc3691602..2f0c9b2221f26f9f93adc836f3e47af0168bddd6 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2611,31 +2611,6 @@ again:
                goto again;
 }
 
-bool reuse_ksm_page(struct page *page,
-                   struct vm_area_struct *vma,
-                   unsigned long address)
-{
-#ifdef CONFIG_DEBUG_VM
-       if (WARN_ON(is_zero_pfn(page_to_pfn(page))) ||
-                       WARN_ON(!page_mapped(page)) ||
-                       WARN_ON(!PageLocked(page))) {
-               dump_page(page, "reuse_ksm_page");
-               return false;
-       }
-#endif
-
-       if (PageSwapCache(page) || !page_stable_node(page))
-               return false;
-       /* Prohibit parallel get_ksm_page() */
-       if (!page_ref_freeze(page, 1))
-               return false;
-
-       page_move_anon_rmap(page, vma);
-       page->index = linear_page_index(vma, address);
-       page_ref_unfreeze(page, 1);
-
-       return true;
-}
 #ifdef CONFIG_MIGRATION
 void ksm_migrate_page(struct page *newpage, struct page *oldpage)
 {