Skip to content

Commit

Permalink
mm: remove unneeded includes of <asm/pgalloc.h>
Browse files Browse the repository at this point in the history
Patch series "mm: cleanup usage of <asm/pgalloc.h>"

Most architectures have very similar versions of pXd_alloc_one() and
pXd_free_one() for intermediate levels of page table.  These patches add
generic versions of these functions in <asm-generic/pgalloc.h> and enable
use of the generic functions where appropriate.

In addition, functions declared and defined in <asm/pgalloc.h> headers are
used mostly by core mm and early mm initialization in arch and there is no
actual reason to have the <asm/pgalloc.h> included all over the place.
The first patch in this series removes unneeded includes of
<asm/pgalloc.h>

In the end it didn't work out as neatly as I hoped and moving
pXd_alloc_track() definitions to <asm-generic/pgalloc.h> would require
unnecessary changes to arches that have custom page table allocations, so
I've decided to move lib/ioremap.c to mm/ and make pgalloc-track.h local
to mm/.

This patch (of 8):

In most cases <asm/pgalloc.h> header is required only for allocations of
page table memory.  Most of the .c files that include that header do not
use symbols declared in <asm/pgalloc.h> and do not require that header.

As for the other header files that used to include <asm/pgalloc.h>, it is
possible to move that include into the .c file that actually uses symbols
from <asm/pgalloc.h> and drop the include from the header file.

The process was somewhat automated using

	sed -i -E '/[<"]asm\/pgalloc\.h/d' \
                $(grep -L -w -f /tmp/xx \
                        $(git grep -E -l '[<"]asm/pgalloc\.h'))

where /tmp/xx contains all the symbols defined in
arch/*/include/asm/pgalloc.h.

[[email protected]: fix powerpc warning]

Signed-off-by: Mike Rapoport <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Pekka Enberg <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>	[m68k]
Cc: Abdul Haleem <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Satheesh Rajendran <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rppt authored and torvalds committed Aug 7, 2020
1 parent 0c4123e commit ca15ca4
Show file tree
Hide file tree
Showing 125 changed files with 17 additions and 118 deletions.
1 change: 0 additions & 1 deletion arch/alpha/include/asm/tlbflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <linux/mm.h>
#include <linux/sched.h>
#include <asm/compiler.h>
#include <asm/pgalloc.h>

#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
Expand Down
1 change: 0 additions & 1 deletion arch/alpha/kernel/core_irongate.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ irongate_init_arch(void)
#include <linux/agp_backend.h>
#include <linux/agpgart.h>
#include <linux/export.h>
#include <asm/pgalloc.h>

#define GET_PAGE_DIR_OFF(addr) (addr >> 22)
#define GET_PAGE_DIR_IDX(addr) (GET_PAGE_DIR_OFF(addr))
Expand Down
1 change: 0 additions & 1 deletion arch/alpha/kernel/core_marvel.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <asm/ptrace.h>
#include <asm/smp.h>
#include <asm/gct.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/vga.h>

Expand Down
1 change: 0 additions & 1 deletion arch/alpha/kernel/core_titan.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <asm/ptrace.h>
#include <asm/smp.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/vga.h>

Expand Down
2 changes: 0 additions & 2 deletions arch/alpha/kernel/machvec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* This file has goodies to help simplify instantiation of machine vectors.
*/

#include <asm/pgalloc.h>

/* Whee. These systems don't have an HAE:
IRONGATE, MARVEL, POLARIS, TSUNAMI, TITAN, WILDFIRE
Fix things up for the GENERIC kernel by defining the HAE address
Expand Down
1 change: 0 additions & 1 deletion arch/alpha/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>
#include <asm/tlbflush.h>

Expand Down
1 change: 0 additions & 1 deletion arch/alpha/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/module.h>

#include <asm/hwrpb.h>
#include <asm/pgalloc.h>
#include <asm/sections.h>

pg_data_t node_data[MAX_NUMNODES];
Expand Down
1 change: 0 additions & 1 deletion arch/arc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/kdebug.h>
#include <linux/perf_event.h>
#include <linux/mm_types.h>
#include <asm/pgalloc.h>
#include <asm/mmu.h>

/*
Expand Down
1 change: 0 additions & 1 deletion arch/arc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/module.h>
#include <linux/highmem.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/sections.h>
#include <asm/arcregs.h>

Expand Down
1 change: 0 additions & 1 deletion arch/arm/include/asm/tlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#else /* !CONFIG_MMU */

#include <linux/swap.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>

static inline void __tlb_remove_table(void *_table)
Expand Down
1 change: 0 additions & 1 deletion arch/arm/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <linux/irq.h>
#include <linux/memblock.h>
#include <linux/of_fdt.h>
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>
#include <asm/fncpy.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <asm/idmap.h>
#include <asm/topology.h>
#include <asm/mmu_context.h>
#include <asm/pgalloc.h>
#include <asm/procinfo.h>
#include <asm/processor.h>
#include <asm/sections.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm/kernel/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <asm/bugs.h>
#include <asm/cacheflush.h>
#include <asm/idmap.h>
#include <asm/pgalloc.h>
#include <asm/memory.h>
#include <asm/smp_plat.h>
#include <asm/suspend.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap2/omap-mpuss-lowpower.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <asm/smp_scu.h>
#include <asm/pgalloc.h>
#include <asm/suspend.h>
#include <asm/virt.h>
#include <asm/hardware/cache-l2x0.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <asm/mman.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>

/*
* On ARM, huge pages are backed by pmd's rather than pte's, so we do a lot
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <asm/traps.h>
#include <asm/procinfo.h>
#include <asm/memory.h>
#include <asm/pgalloc.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <asm/kvm_mmu.h>
#include <asm/mmu_context.h>
#include <asm/numa.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/smp_plat.h>
#include <asm/sections.h>
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <asm/mman.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>

/*
* HugeTLB Support Matrix
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/mm/ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <asm/fixmap.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>

static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
pgprot_t prot, void *caller)
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <asm/mmu_context.h>
#include <asm/ptdump.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>

#define NO_BLOCK_MAPPINGS BIT(0)
#define NO_CONT_MAPPINGS BIT(1)
Expand Down
1 change: 0 additions & 1 deletion arch/csky/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <asm/traps.h>
#include <asm/sections.h>
#include <asm/mmu_context.h>
#include <asm/pgalloc.h>
#ifdef CONFIG_CPU_HAS_FPU
#include <abi/fpu.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/include/asm/tlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <linux/pagemap.h>
#include <linux/swap.h>

#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/tlbflush.h>

Expand Down
1 change: 0 additions & 1 deletion arch/ia64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <asm/elf.h>
#include <asm/irq.h>
#include <asm/kexec.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/sal.h>
#include <asm/switch_to.h>
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/ptrace.h>
#include <asm/sal.h>
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <asm/irq.h>
#include <asm/mca.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/ptrace.h>
#include <asm/sal.h>
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/mm/contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/swap.h>

#include <asm/meminit.h>
#include <asm/pgalloc.h>
#include <asm/sections.h>
#include <asm/mca.h>

Expand Down
1 change: 0 additions & 1 deletion arch/ia64/mm/discontig.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/efi.h>
#include <linux/nodemask.h>
#include <linux/slab.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/meminit.h>
#include <asm/numa.h>
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/sysctl.h>
#include <linux/log2.h>
#include <asm/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>

Expand Down
1 change: 0 additions & 1 deletion arch/ia64/mm/tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <asm/delay.h>
#include <asm/mmu_context.h>
#include <asm/pgalloc.h>
#include <asm/pal.h>
#include <asm/tlbflush.h>
#include <asm/dma.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static inline void activate_mm(struct mm_struct *prev_mm,

#include <asm/setup.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/cacheflush.h>

static inline int init_new_context(struct task_struct *tsk,
struct mm_struct *mm)
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/vmalloc.h>
#include <linux/export.h>

#include <asm/pgalloc.h>
#include <asm/cacheflush.h>

#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
void arch_dma_prep_coherent(struct page *page, size_t size)
Expand Down
3 changes: 1 addition & 2 deletions arch/m68k/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
#include <asm/fpu.h>
#include <linux/uaccess.h>
#include <asm/traps.h>
#include <asm/pgalloc.h>
#include <asm/machdep.h>
#include <asm/siginfo.h>

#include <asm/tlbflush.h>

static const char *vec_names[] = {
[VEC_RESETSP] = "RESET SP",
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/mm/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <linux/module.h>
#include <asm/pgalloc.h>
#include <asm/cacheflush.h>
#include <asm/traps.h>


Expand Down
1 change: 0 additions & 1 deletion arch/m68k/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <asm/setup.h>
#include <asm/traps.h>
#include <asm/pgalloc.h>

extern void die_if_kernel(char *, struct pt_regs *, long);

Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/mm/kmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <asm/setup.h>
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/io.h>
#include <asm/tlbflush.h>

#undef DEBUG

Expand Down
1 change: 1 addition & 0 deletions arch/m68k/mm/mcfmmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <asm/mmu_context.h>
#include <asm/mcf_pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>

#define KMAPAREA(x) ((x >= VMALLOC_START) && (x < KMAP_END))

Expand Down
1 change: 0 additions & 1 deletion arch/m68k/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <asm/setup.h>
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/traps.h>
#include <asm/machdep.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/sun3x/dvma.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <asm/dvma.h>
#include <asm/io.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>

/* IOMMU support */

Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/tlbflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <asm/processor.h> /* For TASK_SIZE */
#include <asm/mmu.h>
#include <asm/page.h>
#include <asm/pgalloc.h>

extern void _tlbie(unsigned long address);
extern void _tlbia(void);
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/tick.h>
#include <linux/bitops.h>
#include <linux/ptrace.h>
#include <asm/pgalloc.h>
#include <linux/uaccess.h> /* for USER_DS macros */
#include <asm/cacheflush.h>

Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <asm/entry.h>
#include <asm/ucontext.h>
#include <linux/uaccess.h>
#include <asm/pgalloc.h>
#include <linux/syscalls.h>
#include <asm/cacheflush.h>
#include <asm/syscalls.h>
Expand Down
1 change: 0 additions & 1 deletion arch/mips/sgi-ip32/ip32-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <asm/ip32/crime.h>
#include <asm/bootinfo.h>
#include <asm/page.h>
#include <asm/pgalloc.h>

extern void crime_init(void);

Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/include/asm/tlbflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include <linux/mm.h>
#include <asm/processor.h>
#include <asm/pgalloc.h>
#include <asm/current.h>
#include <linux/sched.h>

Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/kernel/or32_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <asm/io.h>
#include <asm/hardirq.h>
#include <asm/delay.h>
#include <asm/pgalloc.h>

#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)

Expand Down
1 change: 0 additions & 1 deletion arch/parisc/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/atomic.h>
#include <asm/pgalloc.h>
#include <asm-generic/mm_hooks.h>

static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/kernel/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/sections.h>
#include <asm/shmparam.h>
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <asm/dma.h> /* for DMA_CHUNK_SIZE */
#include <asm/io.h>
#include <asm/page.h> /* get_order */
#include <asm/pgalloc.h>
#include <linux/uaccess.h>
#include <asm/tlbflush.h> /* for purge_tlb_*() macros */

Expand Down
1 change: 0 additions & 1 deletion arch/parisc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <asm/assembly.h>
#include <asm/pdc.h>
#include <asm/pdc_chassis.h>
#include <asm/pgalloc.h>
#include <asm/unwind.h>
#include <asm/sections.h>

Expand Down
Loading

0 comments on commit ca15ca4

Please sign in to comment.