mm: cleanup usage of <asm/pgalloc.h>
Subsystems (42)
Mike Rapoport
reviewercover mm: cleanup usage of <asm/pgalloc.h>
From: Mike Rapoport <[email protected]>
Hi,
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/.
Joerg Roedel (1):
mm: move p?d_alloc_track to separate header file
Mike Rapoport (7):
mm: remove unneeded includes of <asm/pgalloc.h>
opeinrisc: switch to generic version of pte allocation
xtensa: switch to generic version of pte allocation
asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
asm-generic: pgalloc: provide generic pud_alloc_one() and pud_free_one()
asm-generic: pgalloc: provide generic pgd_free()
mm: move lib/ioremap.c to mm/
arch/alpha/include/asm/pgalloc.h | 21 +----
arch/alpha/include/asm/tlbflush.h | 1 -
arch/alpha/kernel/core_irongate.c | 1 -
arch/alpha/kernel/core_marvel.c | 1 -
arch/alpha/kernel/core_titan.c | 1 -
arch/alpha/kernel/machvec_impl.h | 2 -
arch/alpha/kernel/smp.c | 1 -
arch/alpha/mm/numa.c | 1 -
arch/arc/mm/fault.c | 1 -
arch/arc/mm/init.c | 1 -
arch/arm/include/asm/pgalloc.h | 12 +--
arch/arm/include/asm/tlb.h | 1 -
arch/arm/kernel/machine_kexec.c | 1 -
arch/arm/kernel/smp.c | 1 -
arch/arm/kernel/suspend.c | 1 -
arch/arm/mach-omap2/omap-mpuss-lowpower.c | 1 -
arch/arm/mm/hugetlbpage.c | 1 -
arch/arm/mm/mmu.c | 1 +
arch/arm64/include/asm/pgalloc.h | 39 +---------
arch/arm64/kernel/smp.c | 1 -
arch/arm64/mm/hugetlbpage.c | 1 -
arch/arm64/mm/ioremap.c | 1 -
arch/arm64/mm/mmu.c | 1 +
arch/csky/include/asm/pgalloc.h | 7 +-
arch/csky/kernel/smp.c | 1 -
arch/hexagon/include/asm/pgalloc.h | 7 +-
arch/ia64/include/asm/pgalloc.h | 24 ------
arch/ia64/include/asm/tlb.h | 1 -
arch/ia64/kernel/process.c | 1 -
arch/ia64/kernel/smp.c | 1 -
arch/ia64/kernel/smpboot.c | 1 -
arch/ia64/mm/contig.c | 1 -
arch/ia64/mm/discontig.c | 1 -
arch/ia64/mm/hugetlbpage.c | 1 -
arch/ia64/mm/tlb.c | 1 -
arch/m68k/include/asm/mmu_context.h | 2 +-
arch/m68k/include/asm/sun3_pgalloc.h | 7 +-
arch/m68k/kernel/dma.c | 2 +-
arch/m68k/kernel/traps.c | 3 +-
arch/m68k/mm/cache.c | 2 +-
arch/m68k/mm/fault.c | 1 -
arch/m68k/mm/kmap.c | 2 +-
arch/m68k/mm/mcfmmu.c | 1 +
arch/m68k/mm/memory.c | 1 -
arch/m68k/sun3x/dvma.c | 2 +-
arch/microblaze/include/asm/pgalloc.h | 6 --
arch/microblaze/include/asm/tlbflush.h | 1 -
arch/microblaze/kernel/process.c | 1 -
arch/microblaze/kernel/signal.c | 1 -
arch/mips/include/asm/pgalloc.h | 19 +----
arch/mips/sgi-ip32/ip32-memory.c | 1 -
arch/nds32/mm/mm-nds32.c | 2 +
arch/nios2/include/asm/pgalloc.h | 7 +-
arch/openrisc/include/asm/pgalloc.h | 33 +-------
arch/openrisc/include/asm/tlbflush.h | 1 -
arch/openrisc/kernel/or32_ksyms.c | 1 -
arch/parisc/include/asm/mmu_context.h | 1 -
arch/parisc/include/asm/pgalloc.h | 12 +--
arch/parisc/kernel/cache.c | 1 -
arch/parisc/kernel/pci-dma.c | 1 -
arch/parisc/kernel/process.c | 1 -
arch/parisc/kernel/signal.c | 1 -
arch/parisc/kernel/smp.c | 1 -
arch/parisc/mm/hugetlbpage.c | 1 -
arch/parisc/mm/ioremap.c | 2 +-
arch/powerpc/include/asm/tlb.h | 1 -
arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 1 -
arch/powerpc/mm/book3s64/hash_pgtable.c | 1 -
arch/powerpc/mm/book3s64/hash_tlb.c | 1 -
arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 1 -
arch/powerpc/mm/init_32.c | 1 -
arch/powerpc/mm/kasan/8xx.c | 1 -
arch/powerpc/mm/kasan/book3s_32.c | 1 -
arch/powerpc/mm/mem.c | 1 -
arch/powerpc/mm/nohash/40x.c | 1 -
arch/powerpc/mm/nohash/8xx.c | 1 -
arch/powerpc/mm/nohash/fsl_booke.c | 1 -
arch/powerpc/mm/nohash/kaslr_booke.c | 1 -
arch/powerpc/mm/pgtable.c | 1 -
arch/powerpc/mm/pgtable_64.c | 1 -
arch/powerpc/mm/ptdump/hashpagetable.c | 2 +-
arch/powerpc/mm/ptdump/ptdump.c | 1 -
arch/powerpc/platforms/pseries/cmm.c | 1 -
arch/riscv/include/asm/pgalloc.h | 18 +----
arch/riscv/mm/fault.c | 1 -
arch/s390/include/asm/tlb.h | 1 -
arch/s390/include/asm/tlbflush.h | 1 -
arch/s390/kernel/machine_kexec.c | 1 -
arch/s390/kernel/ptrace.c | 1 -
arch/s390/kvm/diag.c | 1 -
arch/s390/kvm/priv.c | 1 -
arch/s390/kvm/pv.c | 1 -
arch/s390/mm/cmm.c | 1 -
arch/s390/mm/mmap.c | 1 -
arch/s390/mm/pgtable.c | 1 -
arch/sh/include/asm/pgalloc.h | 4 +
arch/sh/kernel/idle.c | 1 -
arch/sh/kernel/machine_kexec.c | 1 -
arch/sh/mm/cache-sh3.c | 1 -
arch/sh/mm/cache-sh7705.c | 1 -
arch/sh/mm/hugetlbpage.c | 1 -
arch/sh/mm/init.c | 1 +
arch/sh/mm/ioremap_fixed.c | 1 -
arch/sh/mm/tlb-sh3.c | 1 -
arch/sparc/include/asm/ide.h | 1 -
arch/sparc/include/asm/tlb_64.h | 1 -
arch/sparc/kernel/leon_smp.c | 1 -
arch/sparc/kernel/process_32.c | 1 -
arch/sparc/kernel/signal_32.c | 1 -
arch/sparc/kernel/smp_32.c | 1 -
arch/sparc/kernel/smp_64.c | 1 +
arch/sparc/kernel/sun4m_irq.c | 1 -
arch/sparc/mm/highmem.c | 1 -
arch/sparc/mm/io-unit.c | 1 -
arch/sparc/mm/iommu.c | 1 -
arch/sparc/mm/tlb.c | 1 -
arch/um/include/asm/pgalloc.h | 9 +--
arch/um/include/asm/pgtable-3level.h | 3 -
arch/um/kernel/mem.c | 17 -----
arch/x86/ia32/ia32_aout.c | 1 -
arch/x86/include/asm/mmu_context.h | 1 -
arch/x86/include/asm/pgalloc.h | 42 +---------
arch/x86/kernel/alternative.c | 1 +
arch/x86/kernel/apic/apic.c | 1 -
arch/x86/kernel/mpparse.c | 1 -
arch/x86/kernel/traps.c | 1 -
arch/x86/mm/fault.c | 1 -
arch/x86/mm/hugetlbpage.c | 1 -
arch/x86/mm/kaslr.c | 1 -
arch/x86/mm/pgtable_32.c | 1 -
arch/x86/mm/pti.c | 1 -
arch/x86/platform/uv/bios_uv.c | 1 +
arch/xtensa/include/asm/pgalloc.h | 40 ++++------
arch/xtensa/kernel/xtensa_ksyms.c | 1 -
arch/xtensa/mm/cache.c | 1 -
arch/xtensa/mm/fault.c | 1 -
drivers/block/xen-blkback/common.h | 1 -
drivers/iommu/ipmmu-vmsa.c | 1 -
drivers/xen/balloon.c | 1 -
drivers/xen/privcmd.c | 1 -
fs/binfmt_elf_fdpic.c | 1 -
include/asm-generic/pgalloc.h | 80 ++++++++++++++++++++
include/asm-generic/tlb.h | 1 -
include/linux/mm.h | 45 -----------
lib/Makefile | 1 -
mm/Makefile | 2 +-
mm/hugetlb.c | 1 +
{lib => mm}/ioremap.c | 2 +
mm/pgalloc-track.h | 51 +++++++++++++
mm/sparse.c | 1 -
mm/vmalloc.c | 1 +
151 files changed, 194 insertions(+), 451 deletions(-)
rename {lib => mm}/ioremap.c (99%)
create mode 100644 mm/pgalloc-track.hSignature · 1 line
2.26.2
Mike Rapoport
reviewerPATCH 1/8 mm: remove unneeded includes of <asm/pgalloc.h>
From: Mike Rapoport <[email protected]>
In the 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 inarch/*/include/asm/pgalloc.h.
--- arch/alpha/include/asm/tlbflush.h | 1 - arch/alpha/kernel/core_irongate.c | 1 - arch/alpha/kernel/core_marvel.c | 1 - arch/alpha/kernel/core_titan.c | 1 - arch/alpha/kernel/machvec_impl.h | 2 -- arch/alpha/kernel/smp.c | 1 - arch/alpha/mm/numa.c | 1 - arch/arc/mm/fault.c | 1 - arch/arc/mm/init.c | 1 - arch/arm/include/asm/tlb.h | 1 - arch/arm/kernel/machine_kexec.c | 1 - arch/arm/kernel/smp.c | 1 - arch/arm/kernel/suspend.c | 1 - arch/arm/mach-omap2/omap-mpuss-lowpower.c | 1 - arch/arm/mm/hugetlbpage.c | 1 - arch/arm/mm/mmu.c | 1 + arch/arm64/kernel/smp.c | 1 - arch/arm64/mm/hugetlbpage.c | 1 - arch/arm64/mm/ioremap.c | 1 - arch/arm64/mm/mmu.c | 1 + arch/csky/kernel/smp.c | 1 - arch/ia64/include/asm/tlb.h | 1 - arch/ia64/kernel/process.c | 1 - arch/ia64/kernel/smp.c | 1 - arch/ia64/kernel/smpboot.c | 1 - arch/ia64/mm/contig.c | 1 - arch/ia64/mm/discontig.c | 1 - arch/ia64/mm/hugetlbpage.c | 1 - arch/ia64/mm/tlb.c | 1 - arch/m68k/include/asm/mmu_context.h | 2 +- arch/m68k/kernel/dma.c | 2 +- arch/m68k/kernel/traps.c | 3 +-- arch/m68k/mm/cache.c | 2 +- arch/m68k/mm/fault.c | 1 - arch/m68k/mm/kmap.c | 2 +- arch/m68k/mm/mcfmmu.c | 1 + arch/m68k/mm/memory.c | 1 - arch/m68k/sun3x/dvma.c | 2 +- arch/microblaze/include/asm/tlbflush.h | 1 - arch/microblaze/kernel/process.c | 1 - arch/microblaze/kernel/signal.c | 1 - arch/mips/sgi-ip32/ip32-memory.c | 1 - arch/openrisc/include/asm/tlbflush.h | 1 - arch/openrisc/kernel/or32_ksyms.c | 1 - arch/parisc/include/asm/mmu_context.h | 1 - arch/parisc/kernel/cache.c | 1 - arch/parisc/kernel/pci-dma.c | 1 - arch/parisc/kernel/process.c | 1 - arch/parisc/kernel/signal.c | 1 - arch/parisc/kernel/smp.c | 1 - arch/parisc/mm/hugetlbpage.c | 1 - arch/parisc/mm/ioremap.c | 2 +- arch/powerpc/include/asm/tlb.h | 1 - arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 1 - arch/powerpc/mm/book3s64/hash_pgtable.c | 1 - arch/powerpc/mm/book3s64/hash_tlb.c | 1 - arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 1 - arch/powerpc/mm/init_32.c | 1 - arch/powerpc/mm/kasan/8xx.c | 1 - arch/powerpc/mm/kasan/book3s_32.c | 1 - arch/powerpc/mm/mem.c | 1 - arch/powerpc/mm/nohash/40x.c | 1 - arch/powerpc/mm/nohash/8xx.c | 1 - arch/powerpc/mm/nohash/fsl_booke.c | 1 - arch/powerpc/mm/nohash/kaslr_booke.c | 1 - arch/powerpc/mm/pgtable.c | 1 - arch/powerpc/mm/pgtable_64.c | 1 - arch/powerpc/mm/ptdump/hashpagetable.c | 2 +- arch/powerpc/mm/ptdump/ptdump.c | 1 - arch/powerpc/platforms/pseries/cmm.c | 1 - arch/riscv/mm/fault.c | 1 - arch/s390/include/asm/tlb.h | 1 - arch/s390/include/asm/tlbflush.h | 1 - arch/s390/kernel/machine_kexec.c | 1 - arch/s390/kernel/ptrace.c | 1 - arch/s390/kvm/diag.c | 1 - arch/s390/kvm/priv.c | 1 - arch/s390/kvm/pv.c | 1 - arch/s390/mm/cmm.c | 1 - arch/s390/mm/mmap.c | 1 - arch/s390/mm/pgtable.c | 1 - arch/sh/kernel/idle.c | 1 - arch/sh/kernel/machine_kexec.c | 1 - arch/sh/mm/cache-sh3.c | 1 - arch/sh/mm/cache-sh7705.c | 1 - arch/sh/mm/hugetlbpage.c | 1 - arch/sh/mm/init.c | 1 + arch/sh/mm/ioremap_fixed.c | 1 - arch/sh/mm/tlb-sh3.c | 1 - arch/sparc/include/asm/ide.h | 1 - arch/sparc/include/asm/tlb_64.h | 1 - arch/sparc/kernel/leon_smp.c | 1 - arch/sparc/kernel/process_32.c | 1 - arch/sparc/kernel/signal_32.c | 1 - arch/sparc/kernel/smp_32.c | 1 - arch/sparc/kernel/smp_64.c | 1 + arch/sparc/kernel/sun4m_irq.c | 1 - arch/sparc/mm/highmem.c | 1 - arch/sparc/mm/io-unit.c | 1 - arch/sparc/mm/iommu.c | 1 - arch/sparc/mm/tlb.c | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm/mmu_context.h | 1 - arch/x86/kernel/alternative.c | 1 + arch/x86/kernel/apic/apic.c | 1 - arch/x86/kernel/mpparse.c | 1 - arch/x86/kernel/traps.c | 1 - arch/x86/mm/fault.c | 1 - arch/x86/mm/hugetlbpage.c | 1 - arch/x86/mm/kaslr.c | 1 - arch/x86/mm/pgtable_32.c | 1 - arch/x86/mm/pti.c | 1 - arch/x86/platform/uv/bios_uv.c | 1 + arch/xtensa/kernel/xtensa_ksyms.c | 1 - arch/xtensa/mm/cache.c | 1 - arch/xtensa/mm/fault.c | 1 - drivers/block/xen-blkback/common.h | 1 - drivers/iommu/ipmmu-vmsa.c | 1 - drivers/xen/balloon.c | 1 - drivers/xen/privcmd.c | 1 - fs/binfmt_elf_fdpic.c | 1 - include/asm-generic/tlb.h | 1 - mm/hugetlb.c | 1 + mm/sparse.c | 1 - 124 files changed, 16 insertions(+), 118 deletions(-)
arch/alpha/include/asm/tlbflush.h +0 -1
@@ -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
arch/alpha/kernel/core_irongate.c +0 -1
@@ -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))
arch/alpha/kernel/core_marvel.c +0 -1
@@ -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>
arch/alpha/kernel/core_titan.c +0 -1
@@ -20,7 +20,6 @@#include <asm/ptrace.h> #include <asm/smp.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/vga.h>
arch/alpha/kernel/machvec_impl.h +0 -2
@@ -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
arch/alpha/kernel/smp.c +0 -1
@@ -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>
arch/alpha/mm/numa.c +0 -1
@@ -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 ];
arch/arc/mm/fault.c +0 -1
@@ -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> /*
arch/arc/mm/init.c +0 -1
@@ -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>
arch/arm/include/asm/tlb.h +0 -1
@@ -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)
arch/arm/kernel/machine_kexec.c +0 -1
@@ -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>
arch/arm/kernel/smp.c +0 -1
@@ -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>
arch/arm/kernel/suspend.c +0 -1
@@ -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>
arch/arm/mach-omap2/omap-mpuss-lowpower.c +0 -1
@@ -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>
arch/arm/mm/hugetlbpage.c +0 -1
@@ -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
arch/arm/mm/mmu.c +1 -0
@@ -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>
arch/arm64/kernel/smp.c +0 -1
@@ -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>
arch/arm64/mm/hugetlbpage.c +0 -1
@@ -17,7 +17,6 @@#include <asm/mman.h> #include <asm/tlb.h> #include <asm/tlbflush.h> -#include <asm/pgalloc.h> #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION bool arch_hugetlb_migration_supported (struct hstate *h)
arch/arm64/mm/ioremap.c +0 -1
@@ -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)
arch/arm64/mm/mmu.c +1 -0
@@ -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)
arch/csky/kernel/smp.c +0 -1
@@ -21,7 +21,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
arch/ia64/include/asm/tlb.h +0 -1
@@ -42,7 +42,6 @@#include <linux/pagemap.h> #include <linux/swap.h> -#include <asm/pgalloc.h> #include <asm/processor.h> #include <asm/tlbflush.h>
arch/ia64/kernel/process.c +0 -1
@@ -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>
arch/ia64/kernel/smp.c +0 -1
@@ -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>
arch/ia64/kernel/smpboot.c +0 -1
@@ -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>
arch/ia64/mm/contig.c +0 -1
@@ -21,7 +21,6 @@#include <linux/swap.h> #include <asm/meminit.h> -#include <asm/pgalloc.h> #include <asm/sections.h> #include <asm/mca.h>
arch/ia64/mm/discontig.c +0 -1
@@ -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>
arch/ia64/mm/hugetlbpage.c +0 -1
@@ -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>
arch/ia64/mm/tlb.c +0 -1
@@ -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>
arch/m68k/include/asm/mmu_context.h +1 -1
@@ -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)
arch/m68k/kernel/dma.c +1 -1
@@ -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)
arch/m68k/kernel/traps.c +1 -2
@@ -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" ,
arch/m68k/mm/cache.c +1 -1
@@ -8,7 +8,7 @@*/ #include <linux/module.h> -#include <asm/pgalloc.h> +#include <asm/cacheflush.h> #include <asm/traps.h>
arch/m68k/mm/fault.c +0 -1
@@ -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 );
arch/m68k/mm/kmap.c +1 -1
@@ -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
arch/m68k/mm/mcfmmu.c +1 -0
@@ -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))
arch/m68k/mm/memory.c +0 -1
@@ -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>
arch/m68k/sun3x/dvma.c +1 -1
@@ -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 */
arch/microblaze/include/asm/tlbflush.h +0 -1
@@ -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 );
arch/microblaze/kernel/process.c +0 -1
@@ -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>
arch/microblaze/kernel/signal.c +0 -1
@@ -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>
arch/mips/sgi-ip32/ip32-memory.c +0 -1
@@ -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 );
arch/openrisc/include/asm/tlbflush.h +0 -1
@@ -17,7 +17,6 @@#include <linux/mm.h> #include <asm/processor.h> -#include <asm/pgalloc.h> #include <asm/current.h> #include <linux/sched.h>
arch/openrisc/kernel/or32_ksyms.c +0 -1
@@ -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)
arch/parisc/include/asm/mmu_context.h +0 -1
@@ -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)
arch/parisc/kernel/cache.c +0 -1
@@ -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>
arch/parisc/kernel/pci-dma.c +0 -1
@@ -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 */
arch/parisc/kernel/process.c +0 -1
@@ -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>
arch/parisc/kernel/signal.c +0 -1
@@ -30,7 +30,6 @@#include <asm/ucontext.h> #include <asm/rt_sigframe.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/cacheflush.h> #include <asm/asm-offsets.h>
arch/parisc/kernel/smp.c +0 -1
@@ -39,7 +39,6 @@#include <asm/irq.h> /* for CPU_IRQ_REGION and friends */ #include <asm/mmu_context.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/processor.h> #include <asm/ptrace.h> #include <asm/unistd.h>
arch/parisc/mm/hugetlbpage.c +0 -1
@@ -15,7 +15,6 @@#include <linux/sysctl.h> #include <asm/mman.h> -#include <asm/pgalloc.h> #include <asm/tlb.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h>
arch/parisc/mm/ioremap.c +1 -1
@@ -11,7 +11,7 @@#include <linux/errno.h> #include <linux/module.h> #include <linux/io.h> -#include <asm/pgalloc.h> +#include <linux/mm.h> /* * Generic mapping function (not visible outside):
arch/powerpc/include/asm/tlb.h +0 -1
@@ -12,7 +12,6 @@#ifndef __powerpc64__#include <linux/pgtable.h> #endif -#include <asm/pgalloc.h> #ifndef __powerpc64__#include <asm/page.h> #include <asm/mmu.h>
arch/powerpc/mm/book3s64/hash_hugetlbpage.c +0 -1
@@ -10,7 +10,6 @@#include <linux/mm.h> #include <linux/hugetlb.h> -#include <asm/pgalloc.h> #include <asm/cacheflush.h> #include <asm/machdep.h>
arch/powerpc/mm/book3s64/hash_pgtable.c +0 -1
@@ -9,7 +9,6 @@#include <linux/mm_types.h> #include <linux/mm.h> -#include <asm/pgalloc.h> #include <asm/sections.h> #include <asm/mmu.h> #include <asm/tlb.h>
arch/powerpc/mm/book3s64/hash_tlb.c +0 -1
@@ -21,7 +21,6 @@#include <linux/mm.h> #include <linux/percpu.h> #include <linux/hardirq.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/tlb.h> #include <asm/bug.h>
arch/powerpc/mm/book3s64/radix_hugetlbpage.c +0 -1
@@ -2,7 +2,6 @@#include <linux/mm.h> #include <linux/hugetlb.h> #include <linux/security.h> -#include <asm/pgalloc.h> #include <asm/cacheflush.h> #include <asm/machdep.h> #include <asm/mman.h>
arch/powerpc/mm/init_32.c +0 -1
@@ -29,7 +29,6 @@#include <linux/slab.h> #include <linux/hugetlb.h> -#include <asm/pgalloc.h> #include <asm/prom.h> #include <asm/io.h> #include <asm/mmu.h>
arch/powerpc/mm/kasan/8xx.c +0 -1
@@ -5,7 +5,6 @@#include <linux/kasan.h> #include <linux/memblock.h> #include <linux/hugetlb.h> -#include <asm/pgalloc.h> static int __init kasan_init_shadow_8M (unsigned long k_start,unsigned long k_end,void *block)
arch/powerpc/mm/kasan/book3s_32.c +0 -1
@@ -4,7 +4,6 @@#include <linux/kasan.h> #include <linux/memblock.h> -#include <asm/pgalloc.h> #include <mm/mmu_decl.h> int __init kasan_init_region (void *start,size_t size)
arch/powerpc/mm/mem.c +0 -1
@@ -34,7 +34,6 @@#include <linux/dma-direct.h> #include <linux/kprobes.h> -#include <asm/pgalloc.h> #include <asm/prom.h> #include <asm/io.h> #include <asm/mmu_context.h>
arch/powerpc/mm/nohash/40x.c +0 -1
@@ -32,7 +32,6 @@#include <linux/highmem.h> #include <linux/memblock.h> -#include <asm/pgalloc.h> #include <asm/prom.h> #include <asm/io.h> #include <asm/mmu_context.h>
arch/powerpc/mm/nohash/8xx.c +0 -1
@@ -13,7 +13,6 @@#include <asm/fixmap.h> #include <asm/code-patching.h> #include <asm/inst.h> -#include <asm/pgalloc.h> #include <mm/mmu_decl.h>
arch/powerpc/mm/nohash/fsl_booke.c +0 -1
@@ -37,7 +37,6 @@#include <linux/highmem.h> #include <linux/memblock.h> -#include <asm/pgalloc.h> #include <asm/prom.h> #include <asm/io.h> #include <asm/mmu_context.h>
arch/powerpc/mm/nohash/kaslr_booke.c +0 -1
@@ -14,7 +14,6 @@#include <linux/memblock.h> #include <linux/libfdt.h> #include <linux/crash_core.h> -#include <asm/pgalloc.h> #include <asm/prom.h> #include <asm/kdump.h> #include <mm/mmu_decl.h>
arch/powerpc/mm/pgtable.c +0 -1
@@ -23,7 +23,6 @@#include <linux/percpu.h> #include <linux/hardirq.h> #include <linux/hugetlb.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/tlb.h> #include <asm/hugetlb.h>
arch/powerpc/mm/pgtable_64.c +0 -1
@@ -31,7 +31,6 @@#include <linux/slab.h> #include <linux/hugetlb.h> -#include <asm/pgalloc.h> #include <asm/page.h> #include <asm/prom.h> #include <asm/mmu_context.h>
arch/powerpc/mm/ptdump/hashpagetable.c +1 -1
@@ -17,10 +17,10 @@#include <linux/seq_file.h> #include <linux/const.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/plpar_wrappers.h> #include <linux/memblock.h> #include <asm/firmware.h> +#include <asm/pgalloc.h> struct pg_state {struct seq_file *seq;
arch/powerpc/mm/ptdump/ptdump.c +0 -1
@@ -21,7 +21,6 @@#include <asm/fixmap.h> #include <linux/const.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/hugetlb.h> #include <mm/mmu_decl.h>
arch/powerpc/platforms/pseries/cmm.c +0 -1
@@ -26,7 +26,6 @@#include <asm/firmware.h> #include <asm/hvcall.h> #include <asm/mmu.h> -#include <asm/pgalloc.h> #include <linux/uaccess.h> #include <linux/memory.h> #include <asm/plpar_wrappers.h>
arch/riscv/mm/fault.c +0 -1
@@ -14,7 +14,6 @@#include <linux/signal.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/ptrace.h> #include <asm/tlbflush.h>
arch/s390/include/asm/tlb.h +0 -1
@@ -36,7 +36,6 @@ static inline bool __tlb_remove_page_size(struct mmu_gather *tlb,#define p4d_free_tlb p4d_free_tlb#define pud_free_tlb pud_free_tlb -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm-generic/tlb.h>
arch/s390/include/asm/tlbflush.h +0 -1
@@ -5,7 +5,6 @@#include <linux/mm.h> #include <linux/sched.h> #include <asm/processor.h> -#include <asm/pgalloc.h> /* * Flush all TLB entries on the local CPU.
arch/s390/kernel/machine_kexec.c +0 -1
@@ -16,7 +16,6 @@#include <linux/debug_locks.h> #include <asm/cio.h> #include <asm/setup.h> -#include <asm/pgalloc.h> #include <asm/smp.h> #include <asm/ipl.h> #include <asm/diag.h>
arch/s390/kernel/ptrace.c +0 -1
@@ -25,7 +25,6 @@#include <linux/compat.h> #include <trace/syscall.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <linux/uaccess.h> #include <asm/unistd.h> #include <asm/switch_to.h>
arch/s390/kvm/diag.c +0 -1
@@ -10,7 +10,6 @@#include <linux/kvm.h> #include <linux/kvm_host.h> -#include <asm/pgalloc.h> #include <asm/gmap.h> #include <asm/virtio-ccw.h> #include "kvm-s390.h"
arch/s390/kvm/priv.c +0 -1
@@ -22,7 +22,6 @@#include <asm/ebcdic.h> #include <asm/sysinfo.h> #include <asm/page-states.h> -#include <asm/pgalloc.h> #include <asm/gmap.h> #include <asm/io.h> #include <asm/ptrace.h>
arch/s390/kvm/pv.c +0 -1
@@ -9,7 +9,6 @@#include <linux/kvm_host.h> #include <linux/pagemap.h> #include <linux/sched/signal.h> -#include <asm/pgalloc.h> #include <asm/gmap.h> #include <asm/uv.h> #include <asm/mman.h>
arch/s390/mm/cmm.c +0 -1
@@ -21,7 +21,6 @@#include <linux/oom.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/diag.h> #ifdef CONFIG_CMM_IUCV
arch/s390/mm/mmap.c +0 -1
@@ -17,7 +17,6 @@#include <linux/random.h> #include <linux/compat.h> #include <linux/security.h> -#include <asm/pgalloc.h> #include <asm/elf.h> static unsigned long stack_maxrandom_size (void )
arch/s390/mm/pgtable.c +0 -1
@@ -19,7 +19,6 @@#include <linux/ksm.h> #include <linux/mman.h> -#include <asm/pgalloc.h> #include <asm/tlb.h> #include <asm/tlbflush.h> #include <asm/mmu_context.h>
arch/sh/kernel/idle.c +0 -1
@@ -14,7 +14,6 @@#include <linux/irqflags.h> #include <linux/smp.h> #include <linux/atomic.h> -#include <asm/pgalloc.h> #include <asm/smp.h> #include <asm/bl_bit.h>
arch/sh/kernel/machine_kexec.c +0 -1
@@ -14,7 +14,6 @@#include <linux/ftrace.h> #include <linux/suspend.h> #include <linux/memblock.h> -#include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/io.h> #include <asm/cacheflush.h>
arch/sh/mm/cache-sh3.c +0 -1
@@ -16,7 +16,6 @@#include <asm/cache.h> #include <asm/io.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h>
arch/sh/mm/cache-sh7705.c +0 -1
@@ -20,7 +20,6 @@#include <asm/cache.h> #include <asm/io.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h>
arch/sh/mm/hugetlbpage.c +0 -1
@@ -17,7 +17,6 @@#include <linux/sysctl.h> #include <asm/mman.h> -#include <asm/pgalloc.h> #include <asm/tlb.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h>
arch/sh/mm/init.c +1 -0
@@ -27,6 +27,7 @@#include <asm/sections.h> #include <asm/setup.h> #include <asm/cache.h> +#include <asm/pgalloc.h> #include <linux/sizes.h> pgd_t swapper_pg_dir[PTRS_PER_PGD ];
arch/sh/mm/ioremap_fixed.c +0 -1
@@ -18,7 +18,6 @@#include <linux/proc_fs.h> #include <asm/fixmap.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/addrspace.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h>
arch/sh/mm/tlb-sh3.c +0 -1
@@ -21,7 +21,6 @@#include <asm/io.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h>
arch/sparc/include/asm/ide.h +0 -1
@@ -13,7 +13,6 @@#include <asm/io.h> #ifdef CONFIG_SPARC64 -#include <asm/pgalloc.h> #include <asm/spitfire.h> #include <asm/cacheflush.h> #include <asm/page.h>
arch/sparc/include/asm/tlb_64.h +0 -1
@@ -4,7 +4,6 @@#include <linux/swap.h> #include <linux/pagemap.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/mmu_context.h>
arch/sparc/kernel/leon_smp.c +0 -1
@@ -38,7 +38,6 @@#include <asm/delay.h> #include <asm/irq.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/oplib.h> #include <asm/cpudata.h> #include <asm/asi.h>
arch/sparc/kernel/process_32.c +0 -1
@@ -34,7 +34,6 @@#include <asm/oplib.h> #include <linux/uaccess.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/delay.h> #include <asm/processor.h> #include <asm/psr.h>
arch/sparc/kernel/signal_32.c +0 -1
@@ -23,7 +23,6 @@#include <linux/uaccess.h> #include <asm/ptrace.h> -#include <asm/pgalloc.h> #include <asm/cacheflush.h> /* flush_sig_insns */ #include <asm/switch_to.h>
arch/sparc/kernel/smp_32.c +0 -1
@@ -29,7 +29,6 @@#include <asm/irq.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/oplib.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h>
arch/sparc/kernel/smp_64.c +1 -0
@@ -47,6 +47,7 @@#include <linux/uaccess.h> #include <asm/starfire.h> #include <asm/tlb.h> +#include <asm/pgalloc.h> #include <asm/sections.h> #include <asm/prom.h> #include <asm/mdesc.h>
arch/sparc/kernel/sun4m_irq.c +0 -1
@@ -16,7 +16,6 @@#include <asm/timer.h> #include <asm/traps.h> -#include <asm/pgalloc.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/cacheflush.h>
arch/sparc/mm/highmem.c +0 -1
@@ -29,7 +29,6 @@#include <asm/cacheflush.h> #include <asm/tlbflush.h> -#include <asm/pgalloc.h> #include <asm/vaddrs.h> static pte_t *kmap_pte;
arch/sparc/mm/io-unit.c +0 -1
@@ -15,7 +15,6 @@#include <linux/of.h> #include <linux/of_device.h> -#include <asm/pgalloc.h> #include <asm/io.h> #include <asm/io-unit.h> #include <asm/mxcc.h>
arch/sparc/mm/iommu.c +0 -1
@@ -16,7 +16,6 @@#include <linux/of.h> #include <linux/of_device.h> -#include <asm/pgalloc.h> #include <asm/io.h> #include <asm/mxcc.h> #include <asm/mbus.h>
arch/sparc/mm/tlb.c +0 -1
@@ -10,7 +10,6 @@#include <linux/swap.h> #include <linux/preempt.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h> #include <asm/mmu_context.h>
arch/x86/ia32/ia32_aout.c +0 -1
@@ -30,7 +30,6 @@#include <linux/sched/task_stack.h> #include <linux/uaccess.h> -#include <asm/pgalloc.h> #include <asm/cacheflush.h> #include <asm/user32.h> #include <asm/ia32.h>
arch/x86/include/asm/mmu_context.h +0 -1
@@ -9,7 +9,6 @@#include <trace/events/tlb.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/paravirt.h> #include <asm/debugreg.h>
arch/x86/kernel/alternative.c +1 -0
@@ -6,6 +6,7 @@#include <linux/mutex.h> #include <linux/list.h> #include <linux/stringify.h> +#include <linux/highmem.h> #include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/memory.h>
arch/x86/kernel/apic/apic.c +0 -1
@@ -40,7 +40,6 @@#include <asm/irq_remapping.h> #include <asm/perf_event.h> #include <asm/x86_init.h> -#include <asm/pgalloc.h> #include <linux/atomic.h> #include <asm/mpspec.h> #include <asm/i8259.h>
arch/x86/kernel/mpparse.c +0 -1
@@ -22,7 +22,6 @@#include <asm/irqdomain.h> #include <asm/mtrr.h> #include <asm/mpspec.h> -#include <asm/pgalloc.h> #include <asm/io_apic.h> #include <asm/proto.h> #include <asm/bios_ebda.h>
arch/x86/kernel/traps.c +0 -1
@@ -62,7 +62,6 @@#ifdef CONFIG_X86_64 #include <asm/x86_init.h> -#include <asm/pgalloc.h> #include <asm/proto.h> #else #include <asm/processor-flags.h>
arch/x86/mm/fault.c +0 -1
@@ -21,7 +21,6 @@#include <asm/cpufeature.h> /* boot_cpu_has, ... */ #include <asm/traps.h> /* dotraplinkage, ... */ -#include <asm/pgalloc.h> /* pgd_*(), ... */ #include <asm/fixmap.h> /* VSYSCALL_ADDR */ #include <asm/vsyscall.h> /* emulate_vsyscall */ #include <asm/vm86.h> /* struct vm86 */
arch/x86/mm/hugetlbpage.c +0 -1
@@ -17,7 +17,6 @@#include <asm/mman.h> #include <asm/tlb.h> #include <asm/tlbflush.h> -#include <asm/pgalloc.h> #include <asm/elf.h> #if 0 /* This is just for testing */
arch/x86/mm/kaslr.c +0 -1
@@ -26,7 +26,6 @@#include <linux/memblock.h> #include <linux/pgtable.h> -#include <asm/pgalloc.h> #include <asm/setup.h> #include <asm/kaslr.h>
arch/x86/mm/pgtable_32.c +0 -1
@@ -11,7 +11,6 @@#include <linux/spinlock.h> #include <asm/cpu_entry_area.h> -#include <asm/pgalloc.h> #include <asm/fixmap.h> #include <asm/e820/api.h> #include <asm/tlb.h>
arch/x86/mm/pti.c +0 -1
@@ -34,7 +34,6 @@#include <asm/vsyscall.h> #include <asm/cmdline.h> #include <asm/pti.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/desc.h> #include <asm/sections.h>
arch/x86/platform/uv/bios_uv.c +1 -0
@@ -11,6 +11,7 @@#include <linux/slab.h> #include <asm/efi.h> #include <linux/io.h> +#include <asm/pgalloc.h> #include <asm/uv/bios.h> #include <asm/uv/uv_hub.h>
arch/xtensa/kernel/xtensa_ksyms.c +0 -1
@@ -25,7 +25,6 @@#include <asm/dma.h> #include <asm/io.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/ftrace.h> #ifdef CONFIG_BLK_DEV_FD #include <asm/floppy.h>
arch/xtensa/mm/cache.c +0 -1
@@ -31,7 +31,6 @@#include <asm/tlb.h> #include <asm/tlbflush.h> #include <asm/page.h> -#include <asm/pgalloc.h> /* * Note:
arch/xtensa/mm/fault.c +0 -1
@@ -20,7 +20,6 @@#include <asm/mmu_context.h> #include <asm/cacheflush.h> #include <asm/hardirq.h> -#include <asm/pgalloc.h> DEFINE_PER_CPU(unsigned long, asid_cache) = ASID_USER_FIRST;void bad_page_fault (struct pt_regs *,unsigned long ,int );
drivers/block/xen-blkback/common.h +0 -1
@@ -36,7 +36,6 @@#include <linux/io.h> #include <linux/rbtree.h> #include <asm/setup.h> -#include <asm/pgalloc.h> #include <asm/hypervisor.h> #include <xen/grant_table.h> #include <xen/page.h>
drivers/iommu/ipmmu-vmsa.c +0 -1
@@ -28,7 +28,6 @@#if defined(CONFIG_ARM ) && !defined(CONFIG_IOMMU_DMA )#include <asm/dma-iommu.h> -#include <asm/pgalloc.h> #else #define arm_iommu_create_mapping (...) NULL#define arm_iommu_attach_device (...) -ENODEV
drivers/xen/balloon.c +0 -1
@@ -58,7 +58,6 @@#include <linux/sysctl.h> #include <asm/page.h> -#include <asm/pgalloc.h> #include <asm/tlb.h> #include <asm/xen/hypervisor.h>
drivers/xen/privcmd.c +0 -1
@@ -25,7 +25,6 @@#include <linux/miscdevice.h> #include <linux/moduleparam.h> -#include <asm/pgalloc.h> #include <asm/xen/hypervisor.h> #include <asm/xen/hypercall.h>
fs/binfmt_elf_fdpic.c +0 -1
@@ -38,7 +38,6 @@#include <linux/uaccess.h> #include <asm/param.h> -#include <asm/pgalloc.h> typedef char *elf_caddr_t ;
include/asm-generic/tlb.h +0 -1
@@ -14,7 +14,6 @@#include <linux/mmu_notifier.h> #include <linux/swap.h> #include <linux/hugetlb_inline.h> -#include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h>
mm/hugetlb.c +1 -0
@@ -31,6 +31,7 @@#include <linux/cma.h> #include <asm/page.h> +#include <asm/pgalloc.h> #include <asm/tlb.h> #include <linux/io.h>
mm/sparse.c +0 -1
@@ -16,7 +16,6 @@#include "internal.h" #include <asm/dma.h> -#include <asm/pgalloc.h> /* * Permanent SPARSEMEM data:
Signature · 1 line
2.26.2
Re: [PATCH 1/8] mm: remove unneeded includes of <asm/pgalloc.h>
Quoted 12 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
In the 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
Quoted 8 lines
sed -i -E '/[<"]asm\/pgalloc\.h/d' \ $(grep -L -w -f /tmp/xx \ $(git grep -E -l '[<"]asm/pgalloc\.h'))where
/tmp/xxcontains all the symbols defined inarch/*/include/asm/pgalloc.h.Signed-off-by Mike Rapoport <[email protected]>
For the m68k part:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Mike Rapoport
reviewerPATCH 2/8 opeinrisc: switch to generic version of pte allocation
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
Replace pte_alloc_one(), pte_free() and pte_free_kernel() with the generic implementation. The only actual functional change is the addition of __GFP_ACCOUT for the allocation of the user page tables.
The pte_alloc_one_kernel() is kept back because its implementation on openrisc is different than the generic one.
--- arch/openrisc/include/asm/pgalloc.h | 33 +++-------------------------- 1 file changed, 3 insertions(+), 30 deletions(-)
arch/openrisc/include/asm/pgalloc.h +3 -30
@@ -20,6 +20,9 @@#include <linux/mm.h> #include <linux/memblock.h> +#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL +#include <asm-generic/pgalloc.h> +extern int mem_init_done;#define pmd_populate_kernel (mm, pmd, pte) \
@@ -61,38 +64,8 @@ extern inline pgd_t *pgd_alloc(struct mm_struct *mm) }#endif -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} -extern pte_t *pte_alloc_one_kernel (struct mm_struct *mm); -static inline struct page *pte_alloc_one (struct mm_struct *mm) -{ -struct page *pte; - pte =alloc_pages (GFP_KERNEL ,0 ); -if (!pte) -return NULL ; -clear_page (page_address (pte)); -if (!pgtable_pte_page_ctor (pte)) { -__free_page (pte); -return NULL ; - } -return pte; -} - -static inline void pte_free_kernel (struct mm_struct *mm,pte_t *pte) -{ -free_page ((unsigned long )pte); -} - -static inline void pte_free (struct mm_struct *mm,struct page *pte) -{ -pgtable_pte_page_dtor (pte); -__free_page (pte); -} -#define __pte_free_tlb (tlb, pte, addr) \ do { \ pgtable_pte_page_dtor(pte); \
Signature · 1 line
2.26.2
Re: [PATCH 2/8] opeinrisc: switch to generic version of pte allocation
Quoted 10 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
Replace
pte_alloc_one(),pte_free()andpte_free_kernel()with the generic implementation. The only actual functional change is the addition of__GFP_ACCOUTfor the allocation of the user page tables.The
pte_alloc_one_kernel()is kept back because its implementation on openrisc is different than the generic one.Signed-off-by Mike Rapoport <[email protected]>
Thank's for this.
Mike Rapoport
reviewerPATCH 3/8 xtensa: switch to generic version of pte allocation
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
xtensa clears PTEs during allocation of the page tables and pte_clear() sets the PTE to a non-zero value. Splitting ptes_clear() helper out of pte_alloc_one() and pte_alloc_one_kernel() allows reuse of base generic allocation methods (__pte_alloc_one() and __pte_alloc_one_kernel()) and the common GFP mask for page table allocations.
The pte_free() and pte_free_kernel() implementations on xtensa are identical to the generic ones and can be dropped.
--- arch/xtensa/include/asm/pgalloc.h | 41 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-)
arch/xtensa/include/asm/pgalloc.h +19 -22
@@ -8,9 +8,14 @@#ifndef _XTENSA_PGALLOC_H#define _XTENSA_PGALLOC_H +#ifdef CONFIG_MMU #include <linux/highmem.h> #include <linux/slab.h> +#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL +#define __HAVE_ARCH_PTE_ALLOC_ONE +#include <asm-generic/pgalloc.h> +/* * Allocating and freeing a pmd is trivial: the 1-entry pmd is * inside the pgd, so has no extra memory associated with it.
@@ -33,45 +38,37 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)free_page ((unsigned long )pgd); } +static inline void ptes_clear (pte_t *ptep) +{ +int i; + +for (i =0 ; i <PTRS_PER_PTE ; i++) +pte_clear (NULL ,0 , ptep + i); +} +static inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm) {pte_t *ptep; -int i; - ptep = (pte_t *)__get_free_page (GFP_KERNEL ); + ptep = (pte_t *)__pte_alloc_one_kernel (mm);if (!ptep)return NULL ; -for (i =0 ; i <1024 ; i++) -pte_clear (NULL ,0 , ptep + i); +ptes_clear (ptep);return ptep; }static inline pgtable_t pte_alloc_one (struct mm_struct *mm) { -pte_t *pte;struct page *page; - pte =pte_alloc_one_kernel (mm); -if (!pte) -return NULL ; - page =virt_to_page (pte); -if (!pgtable_pte_page_ctor (page)) { -__free_page (page); + page =__pte_alloc_one (mm,GFP_PGTABLE_USER ); +if (!page)return NULL ; - } +ptes_clear (page_address (page));return page; } -static inline void pte_free_kernel (struct mm_struct *mm,pte_t *pte) -{ -free_page ((unsigned long )pte); -} - -static inline void pte_free (struct mm_struct *mm,pgtable_t pte) -{ -pgtable_pte_page_dtor (pte); -__free_page (pte); -}#define pmd_pgtable (pmd) pmd_page(pmd) +#endif CONFIG_MMU#endif /* _XTENSA_PGALLOC_H */
Signature · 1 line
2.26.2
Mike Rapoport
reviewerPATCH 4/8 asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
For most architectures that support >2 levels of page tables, pmd_alloc_one() is a wrapper for __get_free_pages(), sometimes with __GFP_ZERO and sometimes followed by memset(0) instead.
More elaborate versions on arm64 and x86 account memory for the user page tables and call to pgtable_pmd_page_ctor() as the part of PMD page initialization.
Move the arm64 version to include/asm-generic/pgalloc.h and use the generic version on several architectures.
The pgtable_pmd_page_ctor() is a NOP when ARCH_ENABLE_SPLIT_PMD_PTLOCK is not enabled, so there is no functional change for most architectures except of the addition of __GFP_ACCOUNT for allocation of user page tables.
The pmd_free() is a wrapper for free_page() in all the cases, so no functional change here.
--- arch/alpha/include/asm/pgalloc.h | 15 +--------- arch/arm/include/asm/pgalloc.h | 11 ------- arch/arm64/include/asm/pgalloc.h | 27 +---------------- arch/ia64/include/asm/pgalloc.h | 10 ------- arch/mips/include/asm/pgalloc.h | 8 ++---- arch/parisc/include/asm/pgalloc.h | 11 ++----- arch/riscv/include/asm/pgalloc.h | 13 +-------- arch/sh/include/asm/pgalloc.h | 3 ++ arch/um/include/asm/pgalloc.h | 8 +----- arch/um/include/asm/pgtable-3level.h | 3 -- arch/um/kernel/mem.c | 12 -------- arch/x86/include/asm/pgalloc.h | 26 +---------------- include/asm-generic/pgalloc.h | 43 ++++++++++++++++++++++++++++ 13 files changed, 55 insertions(+), 135 deletions(-)
arch/alpha/include/asm/pgalloc.h +1 -14
@@ -5,7 +5,7 @@#include <linux/mm.h> #include <linux/mmzone.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> /* * Allocate and free page tables. The xxx_kernel() versions are
@@ -40,17 +40,4 @@ pgd_free(struct mm_struct *mm, pgd_t *pgd) free_page((unsigned long)pgd); } -static inline pmd_t * -pmd_alloc_one (struct mm_struct *mm,unsigned long address) -{ -pmd_t *ret = (pmd_t *)__get_free_page (GFP_PGTABLE_USER ); -return ret; -} - -static inline void -pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -free_page ((unsigned long )pmd); -} -#endif /* _ALPHA_PGALLOC_H */
arch/arm/include/asm/pgalloc.h +0 -11
@@ -22,17 +22,6 @@#ifdef CONFIG_ARM_LPAE -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -return (pmd_t *)get_zeroed_page (GFP_KERNEL ); -} - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -BUG_ON ((unsigned long )pmd & (PAGE_SIZE -1 )); -free_page ((unsigned long )pmd); -} -static inline void pud_populate (struct mm_struct *mm,pud_t *pud,pmd_t *pmd) {set_pud (pud,__pud (__pa (pmd) |PMD_TYPE_TABLE ));
arch/arm64/include/asm/pgalloc.h +1 -26
@@ -13,37 +13,12 @@#include <asm/cacheflush.h> #include <asm/tlbflush.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> #define PGD_SIZE (PTRS_PER_PGD * sizeof(pgd_t))#if CONFIG_PGTABLE_LEVELS >2 -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -gfp_t gfp =GFP_PGTABLE_USER ; -struct page *page; - -if (mm == &init_mm) - gfp =GFP_PGTABLE_KERNEL ; - - page =alloc_page (gfp); -if (!page) -return NULL ; -if (!pgtable_pmd_page_ctor (page)) { -__free_page (page); -return NULL ; - } -return page_address (page); -} - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmdp) -{ -BUG_ON ((unsigned long )pmdp & (PAGE_SIZE -1 )); -pgtable_pmd_page_dtor (virt_to_page (pmdp)); -free_page ((unsigned long )pmdp); -} -static inline void __pud_populate (pud_t *pudp,phys_addr_t pmdp,pudval_t prot) {set_pud (pudp,__pud (__phys_to_pud_val (pmdp) | prot));
arch/ia64/include/asm/pgalloc.h +0 -10
@@ -59,16 +59,6 @@ pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)pud_val (*pud_entry) =__pa (pmd); } -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -return (pmd_t *)__get_free_page (GFP_KERNEL | __GFP_ZERO); -} - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -free_page ((unsigned long )pmd); -} -#define __pmd_free_tlb (tlb, pmd, address) pmd_free((tlb)->mm, pmd) static inline void
arch/mips/include/asm/pgalloc.h +2 -6
@@ -13,7 +13,8 @@#include <linux/mm.h> #include <linux/sched.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#define __HAVE_ARCH_PMD_ALLOC_ONE +#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd,pte_t *pte)
@@ -70,11 +71,6 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) return pmd; } -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -free_pages ((unsigned long )pmd,PMD_ORDER ); -} -#define __pmd_free_tlb (tlb, x, addr) pmd_free((tlb)->mm, x)#endif
arch/parisc/include/asm/pgalloc.h +2 -9
@@ -10,7 +10,8 @@#include <asm/cache.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#define __HAVE_ARCH_PMD_FREE +#include <asm-generic/pgalloc.h> /* Allocate the top level pgd (page directory) *
@@ -65,14 +66,6 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) (__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT))); } -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long address) -{ -pmd_t *pmd = (pmd_t *)__get_free_pages (GFP_KERNEL ,PMD_ORDER ); -if (pmd) -memset (pmd,0 ,PAGE_SIZE <<PMD_ORDER ); -return pmd; -} -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) {if (pmd_flag (*pmd) & PxD_FLAG_ATTACHED) {
arch/riscv/include/asm/pgalloc.h +1 -12
@@ -11,7 +11,7 @@#include <asm/tlb.h> #ifdef CONFIG_MMU -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd,pte_t *pte)
@@ -62,17 +62,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)#ifndef __PAGETABLE_PMD_FOLDED -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -return (pmd_t *)__get_free_page ( -GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO); -} - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -free_page ((unsigned long )pmd); -} -#define __pmd_free_tlb (tlb, pmd, addr) pmd_free((tlb)->mm, pmd)#endif /* __PAGETABLE_PMD_FOLDED */
arch/sh/include/asm/pgalloc.h +3 -0
@@ -3,6 +3,9 @@#define __ASM_SH_PGALLOC_H#include <asm/page.h> + +#define __HAVE_ARCH_PMD_ALLOC_ONE +#define __HAVE_ARCH_PMD_FREE#include <asm-generic/pgalloc.h> extern pgd_t *pgd_alloc (struct mm_struct *);
arch/um/include/asm/pgalloc.h +1 -7
@@ -10,7 +10,7 @@#include <linux/mm.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> #define pmd_populate_kernel (mm, pmd, pte) \ set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
@@ -34,12 +34,6 @@ do { \ } while (0)#ifdef CONFIG_3_LEVEL_PGTABLES - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -free_page ((unsigned long )pmd); -} -#define __pmd_free_tlb (tlb,x, address) tlb_remove_page((tlb),virt_to_page(x))#endif
arch/um/include/asm/pgtable-3level.h +0 -3
@@ -78,9 +78,6 @@ static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }#define set_pmd (pmdptr, pmdval) (*(pmdptr) = (pmdval))#endif -struct mm_struct ; -extern pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long address); -static inline void pud_clear (pud_t *pud) {set_pud (pud,__pud (_PAGE_NEWPAGE));
arch/um/kernel/mem.c +0 -12
@@ -201,18 +201,6 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)free_page ((unsigned long ) pgd); } -#ifdef CONFIG_3_LEVEL_PGTABLES -pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long address) -{ -pmd_t *pmd = (pmd_t *)__get_free_page (GFP_KERNEL ); - -if (pmd) -memset (pmd,0 ,PAGE_SIZE ); - -return pmd; -} -#endif -void *uml_kmalloc (int size,int flags) {return kmalloc (size, flags);
arch/x86/include/asm/pgalloc.h +1 -25
@@ -7,7 +7,7 @@#include <linux/pagemap.h> #define __HAVE_ARCH_PTE_ALLOC_ONE -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; }
@@ -86,30 +86,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,#define pmd_pgtable (pmd) pmd_page(pmd)#if CONFIG_PGTABLE_LEVELS >2 -static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -struct page *page; -gfp_t gfp =GFP_KERNEL_ACCOUNT | __GFP_ZERO; - -if (mm == &init_mm) - gfp &= ~__GFP_ACCOUNT; - page =alloc_pages (gfp,0 ); -if (!page) -return NULL ; -if (!pgtable_pmd_page_ctor (page)) { -__free_pages (page,0 ); -return NULL ; - } -return (pmd_t *)page_address (page); -} - -static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) -{ -BUG_ON ((unsigned long )pmd & (PAGE_SIZE -1 )); -pgtable_pmd_page_dtor (virt_to_page (pmd)); -free_page ((unsigned long )pmd); -} -extern void ___pmd_free_tlb (struct mmu_gather *tlb,pmd_t *pmd); static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
include/asm-generic/pgalloc.h +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.26.2
Re: [PATCH 4/8] asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
Quoted 10 lines · Mike Rapoport
More elaborate versions on arm64 and x86 account memory for the user page tables and call to
pgtable_pmd_page_ctor()as the part of PMD page initialization.Move the arm64 version to
include/asm-generic/pgalloc.hand use the generic version on several architectures.The
pgtable_pmd_page_ctor()is a NOP whenARCH_ENABLE_SPLIT_PMD_PTLOCKis not enabled, so there is no functional change for most architectures except of the addition of__GFP_ACCOUNTfor allocation of user page tables.
Thanks for including this line; it reminded me that we're not setting the PageTable flag on the page, nor accounting it to the zone page stats. Hope you don't mind me tagging a patch to do that on as 9/8.
We could also do with a pud_page_[cd]tor and maybe even p4d/pgd versions. But that brings me to the next question -- could/should some of this be moved over to asm-generic/pgalloc.h? The ctor/dtor aren't called from anywhere else, and there's value to reducing the total amount of code in mm.h, but then there's also value to keeping all the ifdef ARCH_ENABLE_SPLIT_PMD_PTLOCK code together too. So I'm a bit torn. What do you think?
Mike Rapoport
reviewerRe: [PATCH 4/8] asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
Quoted 16 lines · Matthew Wilcox
Quoted 10 lines · Mike Rapoport
More elaborate versions on arm64 and x86 account memory for the user page tables and call to
pgtable_pmd_page_ctor()as the part of PMD page initialization.Move the arm64 version to
include/asm-generic/pgalloc.hand use the generic version on several architectures.The
pgtable_pmd_page_ctor()is a NOP whenARCH_ENABLE_SPLIT_PMD_PTLOCKis not enabled, so there is no functional change for most architectures except of the addition of__GFP_ACCOUNTfor allocation of user page tables.Thanks for including this line; it reminded me that we're not setting the PageTable flag on the page, nor accounting it to the zone page stats. Hope you don't mind me tagging a patch to do that on as 9/8.
Quoted 7 lines
We could also do with a pud_page_[cd]tor and maybe even p4d/pgd versions. But that brings me to the next question -- could/should some of this be moved over to
asm-generic/pgalloc.h? The ctor/dtor aren't called from anywhere else, and there's value to reducing the total amount of code inmm.h, but then there's also value to keeping all the ifdefARCH_ENABLE_SPLIT_PMD_PTLOCKcode together too. So I'm a bit torn. What do you think?
There are arhcitectures that don't use asm-generic/pgalloc.h but rather have their own, sometimes completely different, versoins of these funcitons.
I've tried adding linux/pgalloc.h, but I've ended up with contradicting need to include asm/pgalloc.h before the generic code for some architecures or after the generic code for others :)
I think let's leave it in mm.h for now, maybe after several more cleaups we could do better.
Signature · 2 lines
Sincerely yours, Mike.
Mike Rapoport
reviewerRe: [PATCH 4/8] asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
In reply to Matthew WilcoxQuoted 8 lines · Matthew Wilcox
Quoted 7 lines · Mike Rapoport
More elaborate versions on arm64 and x86 account memory for the user page tables and call to
pgtable_pmd_page_ctor()as the part of PMD page initialization.Move the arm64 version to
include/asm-generic/pgalloc.hand use the generic version on several architectures.
Quoted 7 lines
Quoted 3 lines
The
pgtable_pmd_page_ctor()is a NOP whenARCH_ENABLE_SPLIT_PMD_PTLOCKis not enabled, so there is no functional change for most architectures except of the addition of__GFP_ACCOUNTfor allocation of user page tables.Thanks for including this line; it reminded me that we're not setting the PageTable flag on the page, nor accounting it to the zone page stats. Hope you don't mind me tagging a patch to do that on as 9/8.
We also never set PageTable flag for early page tables and for the page tables allocated directly with get_free_page(), e.g PTI, KASAN.
Quoted 7 lines
We could also do with a pud_page_[cd]tor and maybe even p4d/pgd versions. But that brings me to the next question -- could/should some of this be moved over to
asm-generic/pgalloc.h? The ctor/dtor aren't called from anywhere else, and there's value to reducing the total amount of code inmm.h, but then there's also value to keeping all the ifdefARCH_ENABLE_SPLIT_PMD_PTLOCKcode together too. So I'm a bit torn. What do you think?
Signature · 2 lines
Sincerely yours, Mike.
Mike Rapoport
reviewerPATCH 5/8 asm-generic: pgalloc: provide generic pud_alloc_one() and pud_free_one()
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
Several architectures define pud_alloc_one() as a wrapper for __get_free_page() and pud_free() as a wrapper for free_page().
Provide a generic implementation in asm-generic/pgalloc.h and use it where appropriate.
--- arch/arm64/include/asm/pgalloc.h | 11 ----------- arch/ia64/include/asm/pgalloc.h | 9 --------- arch/mips/include/asm/pgalloc.h | 6 +----- arch/x86/include/asm/pgalloc.h | 15 --------------- include/asm-generic/pgalloc.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 31 insertions(+), 40 deletions(-)
arch/arm64/include/asm/pgalloc.h +0 -11
@@ -37,17 +37,6 @@ static inline void __pud_populate(pud_t *pudp, phys_addr_t pmdp, pudval_t prot)#if CONFIG_PGTABLE_LEVELS >3 -static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -return (pud_t *)__get_free_page (GFP_PGTABLE_USER ); -} - -static inline void pud_free (struct mm_struct *mm,pud_t *pudp) -{ -BUG_ON ((unsigned long )pudp & (PAGE_SIZE -1 )); -free_page ((unsigned long )pudp); -} -static inline void __p4d_populate (p4d_t *p4dp,phys_addr_t pudp,p4dval_t prot) {set_p4d (p4dp,__p4d (__phys_to_p4d_val (pudp) | prot));
arch/ia64/include/asm/pgalloc.h +0 -9
@@ -41,15 +41,6 @@ p4d_populate(struct mm_struct *mm, p4d_t * p4d_entry, pud_t * pud) p4d_val(*p4d_entry) = __pa(pud); } -static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -return (pud_t *)__get_free_page (GFP_KERNEL | __GFP_ZERO); -} - -static inline void pud_free (struct mm_struct *mm,pud_t *pud) -{ -free_page ((unsigned long )pud); -}#define __pud_free_tlb (tlb, pud, address) pud_free((tlb)->mm, pud)#endif /* CONFIG_PGTABLE_LEVELS == 4 */
arch/mips/include/asm/pgalloc.h +1 -5
@@ -14,6 +14,7 @@#include <linux/sched.h> #define __HAVE_ARCH_PMD_ALLOC_ONE +#define __HAVE_ARCH_PUD_ALLOC_ONE#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
@@ -87,11 +88,6 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)return pud; } -static inline void pud_free (struct mm_struct *mm,pud_t *pud) -{ -free_pages ((unsigned long )pud,PUD_ORDER ); -} -static inline void p4d_populate (struct mm_struct *mm,p4d_t *p4d,pud_t *pud) {set_p4d (p4d,__p4d ((unsigned long )pud));
arch/x86/include/asm/pgalloc.h +0 -15
@@ -123,21 +123,6 @@ static inline void p4d_populate_safe(struct mm_struct *mm, p4d_t *p4d, pud_t *puset_p4d_safe (p4d,__p4d (_PAGE_TABLE |__pa (pud))); } -static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -gfp_t gfp =GFP_KERNEL_ACCOUNT ; - -if (mm == &init_mm) - gfp &= ~__GFP_ACCOUNT; -return (pud_t *)get_zeroed_page (gfp); -} - -static inline void pud_free (struct mm_struct *mm,pud_t *pud) -{ -BUG_ON ((unsigned long )pud & (PAGE_SIZE -1 )); -free_page ((unsigned long )pud); -} -extern void ___pud_free_tlb (struct mmu_gather *tlb,pud_t *pud); static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
include/asm-generic/pgalloc.h +30 -0
@@ -145,6 +145,36 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)#endif /* CONFIG_PGTABLE_LEVELS > 2 */ +#if CONFIG_PGTABLE_LEVELS >3 + +#ifndef __HAVE_ARCH_PUD_FREE +/** +* pud_alloc_one - allocate a page for PUD-level page table +* @mm: the mm_struct of the current context +* +* Allocates a page using %GFP_PGTABLE_USER for user context and +* %GFP_PGTABLE_KERNEL for kernel context. +* +* Return: pointer to the allocated memory or %NULL on error +*/ +static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) +{ +gfp_t gfp =GFP_PGTABLE_USER ; + +if (mm == &init_mm) + gfp =GFP_PGTABLE_KERNEL ; +return (pud_t *)get_zeroed_page (gfp); +} +#endif + +static inline void pud_free (struct mm_struct *mm,pud_t *pud) +{ +BUG_ON ((unsigned long )pud & (PAGE_SIZE -1 )); +free_page ((unsigned long )pud); +} + +#endif /* CONFIG_PGTABLE_LEVELS > 3 */ +#endif /* CONFIG_MMU */ #endif /* __ASM_GENERIC_PGALLOC_H */
Signature · 1 line
2.26.2
Mike Rapoport
reviewerPATCH 6/8 asm-generic: pgalloc: provide generic pgd_free()
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
Most architectures define pgd_free() as a wrapper for free_page().
Provide a generic version in asm-generic/pgalloc.h and enable its use for most architectures.
--- arch/alpha/include/asm/pgalloc.h | 6 ------ arch/arm/include/asm/pgalloc.h | 1 + arch/arm64/include/asm/pgalloc.h | 1 + arch/csky/include/asm/pgalloc.h | 7 +------ arch/hexagon/include/asm/pgalloc.h | 7 +------ arch/ia64/include/asm/pgalloc.h | 5 ----- arch/m68k/include/asm/sun3_pgalloc.h | 7 +------ arch/microblaze/include/asm/pgalloc.h | 6 ------ arch/mips/include/asm/pgalloc.h | 5 ----- arch/nds32/mm/mm-nds32.c | 2 ++ arch/nios2/include/asm/pgalloc.h | 7 +------ arch/parisc/include/asm/pgalloc.h | 1 + arch/riscv/include/asm/pgalloc.h | 5 ----- arch/sh/include/asm/pgalloc.h | 1 + arch/um/include/asm/pgalloc.h | 1 - arch/um/kernel/mem.c | 5 ----- arch/x86/include/asm/pgalloc.h | 1 + arch/xtensa/include/asm/pgalloc.h | 5 ----- include/asm-generic/pgalloc.h | 7 +++++++ 19 files changed, 18 insertions(+), 62 deletions(-)
arch/alpha/include/asm/pgalloc.h +0 -6
@@ -34,10 +34,4 @@ pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)extern pgd_t *pgd_alloc (struct mm_struct *mm); -static inline void -pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} -#endif /* _ALPHA_PGALLOC_H */
arch/arm/include/asm/pgalloc.h +1 -0
@@ -65,6 +65,7 @@ static inline void clean_pte_table(pte_t *pte)#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL#define __HAVE_ARCH_PTE_ALLOC_ONE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> static inline pte_t *
arch/arm64/include/asm/pgalloc.h +1 -0
@@ -13,6 +13,7 @@#include <asm/cacheflush.h> #include <asm/tlbflush.h> +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> #define PGD_SIZE (PTRS_PER_PGD * sizeof(pgd_t))
arch/csky/include/asm/pgalloc.h +1 -6
@@ -9,7 +9,7 @@#include <linux/sched.h> #define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd,pte_t *pte)
@@ -42,11 +42,6 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)return pte; } -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_pages ((unsigned long )pgd,PGD_ORDER ); -} -static inline pgd_t *pgd_alloc (struct mm_struct *mm) {pgd_t *ret;
arch/hexagon/include/asm/pgalloc.h +1 -6
@@ -11,7 +11,7 @@#include <asm/mem-layout.h> #include <asm/atomic.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> extern unsigned long long kmap_generation;
@@ -41,11 +41,6 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)return pgd; } -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long ) pgd); -} -static inline void pmd_populate (struct mm_struct *mm,pmd_t *pmd,pgtable_t pte) {
arch/ia64/include/asm/pgalloc.h +0 -5
@@ -29,11 +29,6 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)return (pgd_t *)__get_free_page (GFP_KERNEL | __GFP_ZERO); } -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} -#if CONFIG_PGTABLE_LEVELS ==4 static inline void p4d_populate (struct mm_struct *mm,p4d_t * p4d_entry,pud_t * pud)
arch/m68k/include/asm/sun3_pgalloc.h +1 -6
@@ -13,7 +13,7 @@#include <asm/tlb.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> extern const char bad_pmd_string[];
@@ -40,11 +40,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page*/ #define pmd_free (mm, x) do { } while (0) -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long ) pgd); -} -static inline pgd_t *pgd_alloc (struct mm_struct *mm) {pgd_t *new_pgd;
arch/microblaze/include/asm/pgalloc.h +0 -6
@@ -28,12 +28,6 @@ static inline pgd_t *get_pgd(void)return (pgd_t *)__get_free_pages (GFP_KERNEL |__GFP_ZERO,0 ); } -static inline void free_pgd (pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} - -#define pgd_free (mm, pgd) free_pgd(pgd)#define pgd_alloc (mm) get_pgd()#define pmd_pgtable (pmd) pmd_page(pmd)
arch/mips/include/asm/pgalloc.h +0 -5
@@ -49,11 +49,6 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)extern void pgd_init (unsigned long page);extern pgd_t *pgd_alloc (struct mm_struct *mm); -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_pages ((unsigned long )pgd,PGD_ORDER ); -} -#define __pte_free_tlb (tlb,pte,address) \ do { \ pgtable_pte_page_dtor(pte); \
arch/nds32/mm/mm-nds32.c +2 -0
@@ -2,6 +2,8 @@// Copyright (C) 2005-2017 Andes Technology Corporation #include <linux/init_task.h> + +#define __HAVE_ARCH_PGD_FREE#include <asm/pgalloc.h> #define FIRST_KERNEL_PGD_NR (USER_PTRS_PER_PGD)
arch/nios2/include/asm/pgalloc.h +1 -6
@@ -12,7 +12,7 @@#include <linux/mm.h> -#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ +#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd,pte_t *pte)
@@ -34,11 +34,6 @@ extern void pmd_init(unsigned long page, unsigned long pagetable);extern pgd_t *pgd_alloc (struct mm_struct *mm); -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_pages ((unsigned long )pgd,PGD_ORDER ); -} -#define __pte_free_tlb (tlb, pte, addr) \ do { \ pgtable_pte_page_dtor(pte); \
arch/parisc/include/asm/pgalloc.h +1 -0
@@ -11,6 +11,7 @@#include <asm/cache.h> #define __HAVE_ARCH_PMD_FREE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> /* Allocate the top level pgd (page directory)
arch/riscv/include/asm/pgalloc.h +0 -5
@@ -55,11 +55,6 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)return pgd; } -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} -#ifndef __PAGETABLE_PMD_FOLDED#define __pmd_free_tlb (tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
arch/sh/include/asm/pgalloc.h +1 -0
@@ -6,6 +6,7 @@#define __HAVE_ARCH_PMD_ALLOC_ONE#define __HAVE_ARCH_PMD_FREE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> extern pgd_t *pgd_alloc (struct mm_struct *);
arch/um/include/asm/pgalloc.h +0 -1
@@ -25,7 +25,6 @@* Allocate and free page tables. */ extern pgd_t *pgd_alloc (struct mm_struct *); -extern void pgd_free (struct mm_struct *mm,pgd_t *pgd);#define __pte_free_tlb (tlb,pte, address) \ do { \
arch/um/kernel/mem.c +0 -5
@@ -196,11 +196,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm)return pgd; } -void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long ) pgd); -} -void *uml_kmalloc (int size,int flags) {return kmalloc (size, flags);
arch/x86/include/asm/pgalloc.h +1 -0
@@ -7,6 +7,7 @@#include <linux/pagemap.h> #define __HAVE_ARCH_PTE_ALLOC_ONE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; }
arch/xtensa/include/asm/pgalloc.h +0 -5
@@ -33,11 +33,6 @@ pgd_alloc(struct mm_struct *mm)return (pgd_t *)__get_free_pages (GFP_KERNEL | __GFP_ZERO,PGD_ORDER ); } -static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) -{ -free_page ((unsigned long )pgd); -} -static inline void ptes_clear (pte_t *ptep) {int i;
include/asm-generic/pgalloc.h +7 -0
@@ -175,6 +175,13 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)#endif /* CONFIG_PGTABLE_LEVELS > 3 */ +#ifndef __HAVE_ARCH_PGD_FREE +static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) +{ +free_page ((unsigned long )pgd); +} +#endif +#endif /* CONFIG_MMU */ #endif /* __ASM_GENERIC_PGALLOC_H */
Signature · 1 line
2.26.2
Re: [PATCH 6/8] asm-generic: pgalloc: provide generic pgd_free()
Quoted 8 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
Most architectures define
pgd_free()as a wrapper forfree_page().Provide a generic version in
asm-generic/pgalloc.hand enable its use for most architectures.Signed-off-by Mike Rapoport <[email protected]>
For the m68k part:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Mike Rapoport
reviewerPATCH 7/8 mm: move lib/ioremap.c to mm/
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
The functionality in lib/ioremap.c deals with pagetables, vmalloc and caches, so it naturally belongs to mm/
Moving it there will also allow declaring p?d_alloc_track functions in an header file inside mm/ rather than having those declarations in include/linux/mm.h
---
lib/Makefile | 1 -
mm/Makefile | 2 +-
{lib => mm}/ioremap.c | 0
3 files changed, 1 insertion(+), 2 deletions(-)
rename {lib => mm}/ioremap.c (100%)lib/Makefile +0 -1
@@ -37,7 +37,6 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ nmi_backtrace.o nodemask.o win_minmax.o memcat_p.o lib-$(CONFIG_PRINTK) += dump_stack.o -lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o lib-y += kobject.o klist.o
mm/Makefile +1 -1
@@ -38,7 +38,7 @@ mmu-y := nommu.o mmu-$(CONFIG_MMU) := highmem.o memory.o mincore.o \ mlock.o mmap.o mmu_gather.o mprotect.o mremap.o \ msync.o page_vma_mapped.o pagewalk.o \ - pgtable-generic.o rmap.o vmalloc.o + pgtable-generic.o rmap.o vmalloc.o ioremap.o ifdef CONFIG_CROSS_MEMORY_ATTACH
mm/ioremap.c renamed from lib/ioremap.c +0 -0
Signature · 1 line
2.26.2
Mike Rapoport
reviewerPATCH 8/8 mm: move p?d_alloc_track to separate header file
In reply to Mike RapoportFrom: Joerg Roedel <[email protected]>
The functions are only used in two source files, both residing in mm/ subdirectory, so there is no need for them to be in the global <linux/mm.h> header. Move them to the new mm/pgalloc-track.h header and include it only where needed.
[rppt: mv include/linux/pgalloc-track.h mm/]
--- include/linux/mm.h | 45 ---------------------------------------- mm/ioremap.c | 2 ++ mm/pgalloc-track.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++ mm/vmalloc.c | 1 + 4 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 mm/pgalloc-track.h
include/linux/mm.h +0 -45
@@ -2093,51 +2093,11 @@ static inline pud_t *pud_alloc(struct mm_struct *mm, p4d_t *p4d, NULL : pud_offset(p4d, address); } -static inline p4d_t *p4d_alloc_track (struct mm_struct *mm,pgd_t *pgd, -unsigned long address, -pgtbl_mod_mask *mod_mask) - -{ -if (unlikely (pgd_none (*pgd))) { -if (__p4d_alloc (mm, pgd, address)) -return NULL ; - *mod_mask |=PGTBL_PGD_MODIFIED ; - } - -return p4d_offset (pgd, address); -} - -static inline pud_t *pud_alloc_track (struct mm_struct *mm,p4d_t *p4d, -unsigned long address, -pgtbl_mod_mask *mod_mask) -{ -if (unlikely (p4d_none (*p4d))) { -if (__pud_alloc (mm, p4d, address)) -return NULL ; - *mod_mask |=PGTBL_P4D_MODIFIED ; - } - -return pud_offset (p4d, address); -} -static inline pmd_t *pmd_alloc (struct mm_struct *mm,pud_t *pud,unsigned long address) {return (unlikely (pud_none (*pud)) &&__pmd_alloc (mm, pud, address))?NULL :pmd_offset (pud, address); } - -static inline pmd_t *pmd_alloc_track (struct mm_struct *mm,pud_t *pud, -unsigned long address, -pgtbl_mod_mask *mod_mask) -{ -if (unlikely (pud_none (*pud))) { -if (__pmd_alloc (mm, pud, address)) -return NULL ; - *mod_mask |=PGTBL_PUD_MODIFIED ; - } - -return pmd_offset (pud, address); -}#endif /* CONFIG_MMU */ #if USE_SPLIT_PTE_PTLOCKS
@@ -2253,11 +2213,6 @@ static inline void pgtable_pte_page_dtor(struct page *page) ((unlikely (pmd_none (*(pmd))) &&__pte_alloc_kernel (pmd))? \ NULL: pte_offset_kernel(pmd, address)) -#define pte_alloc_kernel_track (pmd, address, mask) \ - ((unlikely(pmd_none(*(pmd))) && \ - (__pte_alloc_kernel(pmd) || ({*(mask)|=PGTBL_PMD_MODIFIED;0;})))?\ - NULL: pte_offset_kernel(pmd, address)) -#if USE_SPLIT_PMD_PTLOCKS static struct page *pmd_to_page (pmd_t *pmd)
mm/ioremap.c +2 -0
@@ -13,6 +13,8 @@#include <linux/export.h> #include <asm/cacheflush.h> +#include "pgalloc-track.h" +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP static int __read_mostly ioremap_p4d_capable;static int __read_mostly ioremap_pud_capable;
mm/pgalloc-track.h new file +51 -0
51 lines not on this page · raw message
mm/vmalloc.c +1 -0
@@ -41,6 +41,7 @@#include <asm/shmparam.h> #include "internal.h" +#include "pgalloc-track.h" bool is_vmalloc_addr (const void *x) {
Signature · 1 line
2.26.2
Quoted 5 lines · Mike Rapoport
Most architectures have very similar versions of
pXd_alloc_one()andpXd_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.
For the series:
[PATCH 9/8] mm: Account PMD tables like PTE tables
In reply to Mike RapoportWe account the PTE level of the page tables to the process in order to make smarter OOM decisions and help diagnose why memory is fragmented. For these same reasons, we should account pages allocated for PMDs. With larger process address spaces and ASLR, the number of PMDs in use is higher than it used to be so the inaccuracy is starting to matter.
--- include/linux/mm.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
include/linux/mm.h +20 -4
@@ -2271,7 +2271,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)return ptlock_ptr (pmd_to_page (pmd)); } -static inline bool pgtable_pmd_page_ctor (struct page *page) +static inline bool pmd_ptlock_init (struct page *page) {#ifdef CONFIG_TRANSPARENT_HUGEPAGE page->pmd_huge_pte =NULL ;
@@ -2279,7 +2279,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page)return ptlock_init (page); } -static inline void pgtable_pmd_page_dtor (struct page *page) +static inline void pmd_ptlock_free (struct page *page) {#ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE (page->pmd_huge_pte, page);
@@ -2296,8 +2296,8 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)return &mm->page_table_lock; } -static inline bool pgtable_pmd_page_ctor (struct page *page) {return true; } -static inline void pgtable_pmd_page_dtor (struct page *page) {} +static inline bool pmd_ptlock_init (struct page *page) {return true; } +static inline void pmd_ptlock_free (struct page *page) {}#define pmd_huge_pte (mm, pmd) ((mm)->pmd_huge_pte)
@@ -2310,6 +2310,22 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd)return ptl; } +static inline bool pgtable_pmd_page_ctor (struct page *page) +{ +if (!pmd_ptlock_init (page)) +return false; +__SetPageTable (page); +inc_zone_page_state (page,NR_PAGETABLE ); +return true; +} + +static inline void pgtable_pmd_page_dtor (struct page *page) +{ +pmd_ptlock_free (page); +__ClearPageTable (page); +dec_zone_page_state (page,NR_PAGETABLE ); +} +/* * No scalability reason to split PUD locks yet, but follow the same pattern * as the PMD locks to make it easier if we decide to. The VM should not be
Signature · 1 line
2.27.0
Re: [PATCH 9/8] mm: Account PMD tables like PTE tables
Quoted 7 lines · Matthew Wilcox
We account the PTE level of the page tables to the process in order to make smarter OOM decisions and help diagnose why memory is fragmented. For these same reasons, we should account pages allocated for PMDs. With larger process address spaces and ASLR, the number of PMDs in use is higher than it used to be so the inaccuracy is starting to matter.
Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Quoted 63 lines
--- include/linux/mm.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)include/linux/mm.h +20
-4@@ -2271,7 +2271,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)return ptlock_ptr (pmd_to_page (pmd)); } -static inline bool pgtable_pmd_page_ctor (struct page *page) +static inline bool pmd_ptlock_init (struct page *page) {#ifdef CONFIG_TRANSPARENT_HUGEPAGE page->pmd_huge_pte =NULL ;@@ -2279,7 +2279,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page)return ptlock_init (page); } -static inline void pgtable_pmd_page_dtor (struct page *page) +static inline void pmd_ptlock_free (struct page *page) {#ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE (page->pmd_huge_pte, page);@@ -2296,8 +2296,8 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)return &mm->page_table_lock; } -static inline bool pgtable_pmd_page_ctor (struct page *page) {return true; } -static inline void pgtable_pmd_page_dtor (struct page *page) {} +static inline bool pmd_ptlock_init (struct page *page) {return true; } +static inline void pmd_ptlock_free (struct page *page) {}#define pmd_huge_pte (mm, pmd) ((mm)->pmd_huge_pte)@@ -2310,6 +2310,22 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd)return ptl; } +static inline bool pgtable_pmd_page_ctor (struct page *page) +{ +if (!pmd_ptlock_init (page)) +return false; +__SetPageTable (page); +inc_zone_page_state (page,NR_PAGETABLE ); +return true; +} + +static inline void pgtable_pmd_page_dtor (struct page *page) +{ +pmd_ptlock_free (page); +__ClearPageTable (page); +dec_zone_page_state (page,NR_PAGETABLE ); +} +/* * No scalability reason to split PUD locks yet, but follow the same pattern * as the PMD locks to make it easier if we decide to. The VM should not be Signature · 1 line
2.27.0
Signature · 2 lines
Sincerely yours, Mike.
Quoted 5 lines · Mike Rapoport
Most architectures have very similar versions of
pXd_alloc_one()andpXd_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.
Very nice cleanup series to the page table code!
FWIW:
Mike Rapoport
reviewerGentle ping.
Quoted 191 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
Hi,
Most architectures have very similar versions of
pXd_alloc_one()andpXd_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 movelib/ioremap.ctomm/and makepgalloc-track.hlocal tomm/.Joerg Roedel (1):
mm: move p?d_alloc_track to separate header fileMike Rapoport (7):
mm: remove unneeded includes of <asm/pgalloc.h>
opeinrisc: switch to generic version of pte allocation
xtensa: switch to generic version of pte allocation
asm-generic: pgalloc: provide genericpmd_alloc_one()andpmd_free_one()
asm-generic: pgalloc: provide genericpud_alloc_one()andpud_free_one()
asm-generic: pgalloc: provide genericpgd_free()
mm: movelib/ioremap.ctomm/arch/alpha/include/asm/pgalloc.h | 21 +---- arch/alpha/include/asm/tlbflush.h | 1 - arch/alpha/kernel/core_irongate.c | 1 - arch/alpha/kernel/core_marvel.c | 1 - arch/alpha/kernel/core_titan.c | 1 - arch/alpha/kernel/machvec_impl.h | 2 - arch/alpha/kernel/smp.c | 1 - arch/alpha/mm/numa.c | 1 - arch/arc/mm/fault.c | 1 - arch/arc/mm/init.c | 1 - arch/arm/include/asm/pgalloc.h | 12 +-- arch/arm/include/asm/tlb.h | 1 - arch/arm/kernel/machine_kexec.c | 1 - arch/arm/kernel/smp.c | 1 - arch/arm/kernel/suspend.c | 1 - arch/arm/mach-omap2/omap-mpuss-lowpower.c | 1 - arch/arm/mm/hugetlbpage.c | 1 - arch/arm/mm/mmu.c | 1 + arch/arm64/include/asm/pgalloc.h | 39 +--------- arch/arm64/kernel/smp.c | 1 - arch/arm64/mm/hugetlbpage.c | 1 - arch/arm64/mm/ioremap.c | 1 - arch/arm64/mm/mmu.c | 1 + arch/csky/include/asm/pgalloc.h | 7 +- arch/csky/kernel/smp.c | 1 - arch/hexagon/include/asm/pgalloc.h | 7 +- arch/ia64/include/asm/pgalloc.h | 24 ------ arch/ia64/include/asm/tlb.h | 1 - arch/ia64/kernel/process.c | 1 - arch/ia64/kernel/smp.c | 1 - arch/ia64/kernel/smpboot.c | 1 - arch/ia64/mm/contig.c | 1 - arch/ia64/mm/discontig.c | 1 - arch/ia64/mm/hugetlbpage.c | 1 - arch/ia64/mm/tlb.c | 1 - arch/m68k/include/asm/mmu_context.h | 2 +- arch/m68k/include/asm/sun3_pgalloc.h | 7 +- arch/m68k/kernel/dma.c | 2 +- arch/m68k/kernel/traps.c | 3 +- arch/m68k/mm/cache.c | 2 +- arch/m68k/mm/fault.c | 1 - arch/m68k/mm/kmap.c | 2 +- arch/m68k/mm/mcfmmu.c | 1 + arch/m68k/mm/memory.c | 1 - arch/m68k/sun3x/dvma.c | 2 +- arch/microblaze/include/asm/pgalloc.h | 6 -- arch/microblaze/include/asm/tlbflush.h | 1 - arch/microblaze/kernel/process.c | 1 - arch/microblaze/kernel/signal.c | 1 - arch/mips/include/asm/pgalloc.h | 19 +---- arch/mips/sgi-ip32/ip32-memory.c | 1 - arch/nds32/mm/mm-nds32.c | 2 + arch/nios2/include/asm/pgalloc.h | 7 +- arch/openrisc/include/asm/pgalloc.h | 33 +------- arch/openrisc/include/asm/tlbflush.h | 1 - arch/openrisc/kernel/or32_ksyms.c | 1 - arch/parisc/include/asm/mmu_context.h | 1 - arch/parisc/include/asm/pgalloc.h | 12 +-- arch/parisc/kernel/cache.c | 1 - arch/parisc/kernel/pci-dma.c | 1 - arch/parisc/kernel/process.c | 1 - arch/parisc/kernel/signal.c | 1 - arch/parisc/kernel/smp.c | 1 - arch/parisc/mm/hugetlbpage.c | 1 - arch/parisc/mm/ioremap.c | 2 +- arch/powerpc/include/asm/tlb.h | 1 - arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 1 - arch/powerpc/mm/book3s64/hash_pgtable.c | 1 - arch/powerpc/mm/book3s64/hash_tlb.c | 1 - arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 1 - arch/powerpc/mm/init_32.c | 1 - arch/powerpc/mm/kasan/8xx.c | 1 - arch/powerpc/mm/kasan/book3s_32.c | 1 - arch/powerpc/mm/mem.c | 1 - arch/powerpc/mm/nohash/40x.c | 1 - arch/powerpc/mm/nohash/8xx.c | 1 - arch/powerpc/mm/nohash/fsl_booke.c | 1 - arch/powerpc/mm/nohash/kaslr_booke.c | 1 - arch/powerpc/mm/pgtable.c | 1 - arch/powerpc/mm/pgtable_64.c | 1 - arch/powerpc/mm/ptdump/hashpagetable.c | 2 +- arch/powerpc/mm/ptdump/ptdump.c | 1 - arch/powerpc/platforms/pseries/cmm.c | 1 - arch/riscv/include/asm/pgalloc.h | 18 +---- arch/riscv/mm/fault.c | 1 - arch/s390/include/asm/tlb.h | 1 - arch/s390/include/asm/tlbflush.h | 1 - arch/s390/kernel/machine_kexec.c | 1 - arch/s390/kernel/ptrace.c | 1 - arch/s390/kvm/diag.c | 1 - arch/s390/kvm/priv.c | 1 - arch/s390/kvm/pv.c | 1 - arch/s390/mm/cmm.c | 1 - arch/s390/mm/mmap.c | 1 - arch/s390/mm/pgtable.c | 1 - arch/sh/include/asm/pgalloc.h | 4 + arch/sh/kernel/idle.c | 1 - arch/sh/kernel/machine_kexec.c | 1 - arch/sh/mm/cache-sh3.c | 1 - arch/sh/mm/cache-sh7705.c | 1 - arch/sh/mm/hugetlbpage.c | 1 - arch/sh/mm/init.c | 1 + arch/sh/mm/ioremap_fixed.c | 1 - arch/sh/mm/tlb-sh3.c | 1 - arch/sparc/include/asm/ide.h | 1 - arch/sparc/include/asm/tlb_64.h | 1 - arch/sparc/kernel/leon_smp.c | 1 - arch/sparc/kernel/process_32.c | 1 - arch/sparc/kernel/signal_32.c | 1 - arch/sparc/kernel/smp_32.c | 1 - arch/sparc/kernel/smp_64.c | 1 + arch/sparc/kernel/sun4m_irq.c | 1 - arch/sparc/mm/highmem.c | 1 - arch/sparc/mm/io-unit.c | 1 - arch/sparc/mm/iommu.c | 1 - arch/sparc/mm/tlb.c | 1 - arch/um/include/asm/pgalloc.h | 9 +-- arch/um/include/asm/pgtable-3level.h | 3 - arch/um/kernel/mem.c | 17 ----- arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm/mmu_context.h | 1 - arch/x86/include/asm/pgalloc.h | 42 +--------- arch/x86/kernel/alternative.c | 1 + arch/x86/kernel/apic/apic.c | 1 - arch/x86/kernel/mpparse.c | 1 - arch/x86/kernel/traps.c | 1 - arch/x86/mm/fault.c | 1 - arch/x86/mm/hugetlbpage.c | 1 - arch/x86/mm/kaslr.c | 1 - arch/x86/mm/pgtable_32.c | 1 - arch/x86/mm/pti.c | 1 - arch/x86/platform/uv/bios_uv.c | 1 + arch/xtensa/include/asm/pgalloc.h | 40 ++++------ arch/xtensa/kernel/xtensa_ksyms.c | 1 - arch/xtensa/mm/cache.c | 1 - arch/xtensa/mm/fault.c | 1 - drivers/block/xen-blkback/common.h | 1 - drivers/iommu/ipmmu-vmsa.c | 1 - drivers/xen/balloon.c | 1 - drivers/xen/privcmd.c | 1 - fs/binfmt_elf_fdpic.c | 1 - include/asm-generic/pgalloc.h | 80 ++++++++++++++++++++ include/asm-generic/tlb.h | 1 - include/linux/mm.h | 45 ----------- lib/Makefile | 1 - mm/Makefile | 2 +- mm/hugetlb.c | 1 + {lib => mm}/ioremap.c | 2 + mm/pgalloc-track.h | 51 +++++++++++++ mm/sparse.c | 1 - mm/vmalloc.c | 1 + 151 files changed, 194 insertions(+), 451 deletions(-) rename {lib => mm}/ioremap.c (99%) create mode 100644 mm/pgalloc-track.hSignature · 1 line
2.26.2
Signature · 2 lines
Sincerely yours, Mike.