Merge tag 'for-linux-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[linux-2.6-microblaze.git] / mm / mincore.c
index 453ff11..02db1a8 100644 (file)
@@ -48,7 +48,7 @@ static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
  * and is up to date; i.e. that no page-in operation would be required
  * at this time if an application were to map and access this page.
  */
-static unsigned char mincore_page(struct address_space *mapping, pgoff_t pgoff)
+static unsigned char mincore_page(struct address_space *mapping, pgoff_t index)
 {
        unsigned char present = 0;
        struct page *page;
@@ -59,31 +59,7 @@ static unsigned char mincore_page(struct address_space *mapping, pgoff_t pgoff)
         * any other file mapping (ie. marked !present and faulted in with
         * tmpfs's .fault). So swapped out tmpfs mappings are tested here.
         */
-#ifdef CONFIG_SWAP
-       if (shmem_mapping(mapping)) {
-               page = find_get_entry(mapping, pgoff);
-               /*
-                * shmem/tmpfs may return swap: account for swapcache
-                * page too.
-                */
-               if (xa_is_value(page)) {
-                       swp_entry_t swp = radix_to_swp_entry(page);
-                       struct swap_info_struct *si;
-
-                       /* Prevent swap device to being swapoff under us */
-                       si = get_swap_device(swp);
-                       if (si) {
-                               page = find_get_page(swap_address_space(swp),
-                                                    swp_offset(swp));
-                               put_swap_device(si);
-                       } else
-                               page = NULL;
-               }
-       } else
-               page = find_get_page(mapping, pgoff);
-#else
-       page = find_get_page(mapping, pgoff);
-#endif
+       page = find_get_incore_page(mapping, index);
        if (page) {
                present = PageUptodate(page);
                put_page(page);