Skip to content

arch, mm: reduce code duplication in mem_init()

Mike Rapoport linux-alpha linux-arch linux-csky linux-hexagon linux-m68k linux-mips linux-mm linux-parisc linux-riscv linux-s390 linux-sh linux-snps-arc linux-um linuxppc-dev lkml loongarch openrisc regressions sparclinux 2 versions – Applied

Status from this message: [merged mm-stable] arch-mm-make-releasing-of-memory-to-page-allocator-more-explicit.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 26 repliesApplied 13/13
  2. v113 patches 18 repliesSuperseded

Changes in v2 from the cover letter

* don't use generic version for setting high_memory on architectures that use that varialble earlier than free_area_init()
* use memblock_alloc_or_panig() to allocate zero pages on MIPS and s390
* fix alignment in allocation of zero pages on s390
* add Acked-by

Patches in v2 All 13 applied

#Subject and filesSizeRepliesApplied
1/13arm: mem_init: use memblock_phys_free() to free DMA memory on SA1111arch/arm/mm/init.c+4 -40 repliesApplied
2/13csky: move setup_initrd() to setup.carch/csky/kernel/setup.c arch/csky/mm/init.c+43 -430 repliesApplied
3/13hexagon: move initialization of init_mm.context init to paging_init()arch/hexagon/mm/init.c+6 -80 repliesApplied
4/13MIPS: consolidate mem_init() for NUMA machinesarch/mips/loongson64/numa.c arch/mips/mm/init.c arch/mips/sgi-ip27/ip27-memory.c+7 -160 repliesApplied
5/13MIPS: make setup_zero_pages() use memblockarch/mips/include/asm/mmzone.h arch/mips/mm/init.c+5 -150 repliesApplied
6/13nios2: move pr_debug() about memory start and end to setup_arch()arch/nios2/kernel/setup.c arch/nios2/mm/init.c+2 -21 replyApplied
7/13s390: make setup_zero_pages() use memblockarch/s390/mm/init.c+3 -130 repliesApplied
8/13xtensa: split out printing of virtual memory layout to a functionarch/xtensa/mm/init.c+50 -471 replyApplied
9/13arch, mm: set max_mapnr when allocating memory map for FLATMEMarch/alpha/mm/init.c arch/arc/mm/init.c arch/arm/mm/init.c +23 more+21 -862 repliesApplied
10/13arch, mm: set high_memory in free_area_init()arch/alpha/mm/init.c arch/arc/mm/init.c arch/arm64/mm/init.c +22 more+30 -6211 repliesApplied
11/13arch, mm: streamline HIGHMEM freeingarch/arc/mm/init.c arch/arm/mm/init.c arch/csky/mm/init.c +13 more+2 -2391 replyApplied
12/13arch, mm: introduce arch_mm_preinitarch/arc/mm/init.c arch/arm/mm/init.c arch/arm64/mm/init.c +10 more+77 -400 repliesApplied
13/13arch, mm: make releasing of memory to page allocator more explicitarch/alpha/mm/init.c arch/arc/mm/init.c arch/arm/mm/init.c +24 more+7 -1369 repliesApplied

Reviews trailers per patch

8 of 13 patches have a Reviewed-by or Acked-by.

PatchHeiko CarstensDave HansenGeert UytterhoevenMark BrownMax FilippovDinh NguyenAlexandre Ghiti
SeriesT-b
1/13
2/13
3/13
4/13
5/13
6/13A-b
7/13A-b
8/13R-b
9/13A-b
10/13A-b T-b
11/13A-b
12/13A-b
13/13A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 7 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/13] arch, mm: reduce code duplication in mem_init()

From: "Mike Rapoport (Microsoft)" <[email protected]>

Hi,

Every architecture has implementation of mem_init() function and some even more than one. All these release free memory to the buddy allocator, most of them set high_memory to the end of directly addressable memory and many of them set max_mapnr for FLATMEM case.

These patches pull the commonalities into the generic code and refactor some of the mem_init() implementations so that many of them can be just dropped.

v2 changes:
* don't use generic version for setting high_memory on architectures that use that varialble earlier than free_area_init()
* use memblock_alloc_or_panig() to allocate zero pages on MIPS and s390
* fix alignment in allocation of zero pages on s390
* add Acked-by

v1: https://lore.kernel.org/all/[email protected]

Mike Rapoport (Microsoft) (13):
arm: mem_init: use memblock_phys_free() to free DMA memory on SA1111
csky: move setup_initrd() to setup.c
hexagon: move initialization of init_mm.context init to paging_init()
MIPS: consolidate mem_init() for NUMA machines
MIPS: make setup_zero_pages() use memblock
nios2: move pr_debug() about memory start and end to setup_arch()
s390: make setup_zero_pages() use memblock
xtensa: split out printing of virtual memory layout to a function arch, mm: set max_mapnr when allocating memory map for FLATMEM arch, mm: set high_memory in free_area_init()
arch, mm: streamline HIGHMEM freeing
arch, mm: introduce arch_mm_preinit
arch, mm: make releasing of memory to page allocator more explicit

 arch/alpha/mm/init.c               |  8 ----
 arch/arc/mm/init.c                 | 25 +----------
 arch/arm/mm/init.c                 | 43 +------------------
 arch/arm64/mm/init.c               | 12 +-----
 arch/csky/kernel/setup.c           | 43 +++++++++++++++++++
 arch/csky/mm/init.c                | 67 ------------------------------
 arch/hexagon/mm/init.c             | 32 ++------------
 arch/loongarch/kernel/numa.c       |  6 ---
 arch/loongarch/mm/init.c           |  8 ----
 arch/m68k/mm/init.c                |  2 -
 arch/microblaze/mm/init.c          | 25 -----------
 arch/mips/include/asm/mmzone.h     |  2 -
 arch/mips/loongson64/numa.c        |  7 ----
 arch/mips/mm/init.c                | 51 ++++-------------------
 arch/mips/sgi-ip27/ip27-memory.c   |  9 ----
 arch/nios2/kernel/setup.c          |  3 +-
 arch/nios2/mm/init.c               | 16 +------
 arch/openrisc/mm/init.c            |  6 ---
 arch/parisc/mm/init.c              |  4 --
 arch/powerpc/kernel/setup-common.c |  2 -
 arch/powerpc/mm/mem.c              | 18 +-------
 arch/riscv/mm/init.c               |  5 +--
 arch/s390/mm/init.c                | 20 +--------
 arch/sh/mm/init.c                  | 10 -----
 arch/sparc/mm/init_32.c            | 31 +-------------
 arch/sparc/mm/init_64.c            |  4 --
 arch/um/include/shared/mem_user.h  |  1 -
 arch/um/kernel/mem.c               |  9 ++--
 arch/um/kernel/physmem.c           | 12 ------
 arch/um/kernel/um_arch.c           |  2 -
 arch/x86/include/asm/highmem.h     |  3 --
 arch/x86/include/asm/numa.h        |  4 --
 arch/x86/include/asm/numa_32.h     | 13 ------
 arch/x86/kernel/setup.c            |  2 -
 arch/x86/mm/Makefile               |  2 -
 arch/x86/mm/highmem_32.c           | 34 ---------------
 arch/x86/mm/init_32.c              | 41 ++----------------
 arch/x86/mm/init_64.c              |  7 ++--
 arch/x86/mm/numa_32.c              |  3 --
 arch/xtensa/mm/init.c              | 66 +++++++----------------------
 include/asm-generic/memory_model.h |  5 ++-
 include/linux/memblock.h           |  1 -
 include/linux/mm.h                 | 13 +-----
 mm/internal.h                      |  3 +-
 mm/memblock.c                      |  3 +-
 mm/memory.c                        | 16 -------
 mm/mm_init.c                       | 65 +++++++++++++++++++++++++----
 mm/nommu.c                         |  6 ---
 48 files changed, 158 insertions(+), 612 deletions(-)
 delete mode 100644 arch/x86/include/asm/numa_32.h
 delete mode 100644 arch/x86/mm/highmem_32.c

base-commit: d082ecbc71e9e0bf49883ee4afd435a77a5101b6

Signature · 1 line
2.47.2