The patch titled Subject: mm: Move page_mapping_file to pagemap.h has been added to the -mm tree. Its filename is mm-move-page_mapping_file-to-pagemaph.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-move-page_mapping_file-to-pagemaph.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-move-page_mapping_file-to-pagemaph.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm: Move page_mapping_file to pagemap.h page_mapping_file() is only used by some architectures, and then it is usually only used in one place. Make it a static inline function so other architectures don't have to carry this dead code. Link: https://lkml.kernel.org/r/20210317123011.350118-1-willy@xxxxxxxxxxxxx Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Acked-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Cc: Huang Ying <ying.huang@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/arm/mm/copypage-v4mc.c | 1 + arch/arm/mm/copypage-v6.c | 1 + arch/arm/mm/copypage-xscale.c | 1 + arch/csky/abiv1/cacheflush.c | 1 + arch/mips/mm/cache.c | 1 + arch/nios2/mm/cacheflush.c | 1 + arch/sh/mm/cache-sh4.c | 1 + arch/sh/mm/cache-sh7705.c | 1 + arch/sparc/mm/tlb.c | 1 + include/linux/mm.h | 1 - include/linux/pagemap.h | 10 ++++++++++ mm/util.c | 10 ---------- 12 files changed, 19 insertions(+), 11 deletions(-) --- a/arch/arm/mm/copypage-v4mc.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/arm/mm/copypage-v4mc.c @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/pagemap.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h> --- a/arch/arm/mm/copypage-v6.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/arm/mm/copypage-v6.c @@ -8,6 +8,7 @@ #include <linux/spinlock.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/pagemap.h> #include <asm/shmparam.h> #include <asm/tlbflush.h> --- a/arch/arm/mm/copypage-xscale.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/arm/mm/copypage-xscale.c @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/pagemap.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h> --- a/arch/csky/abiv1/cacheflush.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/csky/abiv1/cacheflush.c @@ -4,6 +4,7 @@ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/fs.h> +#include <linux/pagemap.h> #include <linux/syscalls.h> #include <linux/spinlock.h> #include <asm/page.h> --- a/arch/mips/mm/cache.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/mips/mm/cache.c @@ -15,6 +15,7 @@ #include <linux/syscalls.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/pagemap.h> #include <asm/cacheflush.h> #include <asm/processor.h> --- a/arch/nios2/mm/cacheflush.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/nios2/mm/cacheflush.c @@ -11,6 +11,7 @@ #include <linux/sched.h> #include <linux/mm.h> #include <linux/fs.h> +#include <linux/pagemap.h> #include <asm/cacheflush.h> #include <asm/cpuinfo.h> --- a/arch/sh/mm/cache-sh4.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/sh/mm/cache-sh4.c @@ -16,6 +16,7 @@ #include <linux/mutex.h> #include <linux/fs.h> #include <linux/highmem.h> +#include <linux/pagemap.h> #include <asm/mmu_context.h> #include <asm/cache_insns.h> #include <asm/cacheflush.h> --- a/arch/sh/mm/cache-sh7705.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/sh/mm/cache-sh7705.c @@ -13,6 +13,7 @@ #include <linux/mman.h> #include <linux/mm.h> #include <linux/fs.h> +#include <linux/pagemap.h> #include <linux/threads.h> #include <asm/addrspace.h> #include <asm/page.h> --- a/arch/sparc/mm/tlb.c~mm-move-page_mapping_file-to-pagemaph +++ a/arch/sparc/mm/tlb.c @@ -9,6 +9,7 @@ #include <linux/mm.h> #include <linux/swap.h> #include <linux/preempt.h> +#include <linux/pagemap.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h> --- a/include/linux/mm.h~mm-move-page_mapping_file-to-pagemaph +++ a/include/linux/mm.h @@ -1619,7 +1619,6 @@ static inline pgoff_t page_index(struct bool page_mapped(struct page *page); struct address_space *page_mapping(struct page *page); -struct address_space *page_mapping_file(struct page *page); /* * Return true only if the page has been allocated with --- a/include/linux/pagemap.h~mm-move-page_mapping_file-to-pagemaph +++ a/include/linux/pagemap.h @@ -163,6 +163,16 @@ static inline void filemap_nr_thps_dec(s void release_pages(struct page **pages, int nr); /* + * For file cache pages, return the address_space, otherwise return NULL + */ +static inline struct address_space *page_mapping_file(struct page *page) +{ + if (unlikely(PageSwapCache(page))) + return NULL; + return page_mapping(page); +} + +/* * speculatively take a reference to a page. * If the page is free (_refcount == 0), then _refcount is untouched, and 0 * is returned. Otherwise, _refcount is incremented by 1 and 1 is returned. --- a/mm/util.c~mm-move-page_mapping_file-to-pagemaph +++ a/mm/util.c @@ -711,16 +711,6 @@ struct address_space *page_mapping(struc } EXPORT_SYMBOL(page_mapping); -/* - * For file cache pages, return the address_space, otherwise return NULL - */ -struct address_space *page_mapping_file(struct page *page) -{ - if (unlikely(PageSwapCache(page))) - return NULL; - return page_mapping(page); -} - /* Slow path of page_mapcount() for compound pages */ int __page_mapcount(struct page *page) { _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are mm-filemap-use-filemap_read_page-in-filemap_fault.patch mm-filemap-drop-check-for-truncated-page-after-i-o.patch mm-introduce-and-use-mapping_empty.patch mm-stop-accounting-shadow-entries.patch dax-account-dax-entries-as-nrpages.patch mm-remove-nrexceptional-from-inode.patch mm-move-page_mapping_file-to-pagemaph.patch mm-page_alloc-rename-alloc_mask-to-alloc_gfp.patch mm-page_alloc-rename-gfp_mask-to-gfp.patch mm-page_alloc-combine-__alloc_pages-and-__alloc_pages_nodemask.patch mm-mempolicy-rename-alloc_pages_current-to-alloc_pages.patch mm-mempolicy-rewrite-alloc_pages-documentation.patch mm-mempolicy-rewrite-alloc_pages_vma-documentation.patch mm-mempolicy-fix-mpol_misplaced-kernel-doc.patch include-remove-pagemaph-from-blkdevh.patch