Skip to content

mm: highmem cleanups

Arnd Bergmann linux-arm-kernel linux-fsdevel linux-mm linuxppc-dev sashiko-reviews stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 13 repliesIn review
  2. v26 patches 19 repliesSuperseded

Changes in v3 from the cover letter

- Add preparation patch for Arm PXA [sashiko-bot]
- Add preparation patch for powerpc32/kvm [sashiko-bot]
- Fix Arm ARCH_MMAP_RND_BITS_MAX calculation [sashiko-bot]
- Simplification for pte_alloc_one() [Mike Rapoport]
- Drop stale references to highpte [David Hildenbrand]
- improve __print_bad_page_map_pgtable()
- Split out Arm changes for CONFIG_VMSPLIT_2G_OPT

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10ARM: remove support for highmem on VIVTarch/arm/Kconfig arch/arm/configs/gemini_defconfig arch/arm/configs/multi_v5_defconfig +6 more+16 -1532 replies
2/10ARM: drop CONFIG_HIGHPTE supportarch/arm/Kconfig arch/arm/configs/vt8500_v6_v7_defconfig arch/arm/include/asm/pgalloc.h+3 -220 replies
3/10ARM: pxa: support arbitrary PAGE_OFFSETarch/arm/mach-pxa/pxa3xx.c+1 -10 replies
4/10powerpc: kvm: allow flexible PAGE_OFFSETarch/powerpc/kvm/book3s_32_sr.S arch/powerpc/kvm/booke_interrupts.S arch/powerpc/kvm/e500_mmu_host.c+6 -54 replies
5/10ARM: add CONFIG_VMSPLIT_2G_OPT optionarch/arm/Kconfig+7 -20 replies
6/10arch/*: increase lowmem size to avoid highmem usearch/arm/Kconfig arch/arm/configs/u8500_defconfig arch/arm/configs/vt8500_v6_v7_defconfig +7 more+29 -202 replies
7/10ARM: defconfig: turn off highmem in favor of CONFIG_VMSPLIT_2G_OPTarch/arm/configs/aspeed_g5_defconfig arch/arm/configs/lpae.config arch/arm/configs/multi_v7_defconfig +2 more+4 -30 replies
8/10mm: remove ARCH_NEEDS_KMAP_HIGH_GETmm/highmem.c+10 -901 reply
9/10mm: drop HIGHPTE support altogetherinclude/linux/hugetlb.h include/linux/mm.h include/linux/pgtable.h +2 more+14 -360 replies
10/10mm: print pte in __print_bad_page_map_pgtable()mm/memory.c+14 -73 replies

Reviews trailers per patch

7 of 10 patches have a Reviewed-by or Acked-by.

PatchLorenzo Stoakes (ARM)Mike Rapoport (Microsoft)David Hildenbrand (Arm)Linus Walleij
1/10A-b R-b
2/10A-b
3/10
4/10
5/10A-b A-b
6/10A-b A-b
7/10
8/10A-b A-b A-b
9/10A-b A-b A-b
10/10A-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 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/10] mm: highmem cleanups

From: Arnd Bergmann <[email protected]>

This is an updated series from what I posted last year [1] and last week[2].

At LPC 2025 [3], we got rough consensus on the plan to keep the funcationality present for the time being but instead reduce the scope of highmem in the kernel as much as we can without hurting users.

The short summary is a three stage process:

1. Nudge users towards using a larger lowmem zone with the CONFIG_VMSPLIT_* options if at all possible.

2. Drop most __GFP_HIGHMEM allocations and corresponding kmap() calls from the kernel, leaving only the subset that is likely to contain the majority of the actual allocations. Specifically we will keep anonymous and regular file backed user mappings, zsmalloc, and huge pages.

3. In a few years, also drop the page cache allocations and leave perhaps only zsmalloc using a much simpler interface. I suggested five years as the time until we do this, but the timing depends a lot on how the first two stages work out in practice, and how long the remaining highmem users plan to keep updating their kernels.

This series implements stage 1, mostly using Kconfig changes to the default settings but leaving the traditional behavior as a CONFIG_EXPERT choice in Kconfig. With the new defaults, most installations that use highmem today with 1 GiB or 2 GiB of system RAM will see all of their RAM in the lowmem zone after upgrading their kernels. My estimate is that instead of 80% to 90% of maintained embedded 32-bit systems, this should cover over 98%.

As I don't actually have hardware in the category that still needs highmem, I tested this using a qemu-system for Armv7 and PPC6xx running a Debian userland with all combinations of VMSPLIT and HIGHMEM options. I ran some kernel builds on the Arm guest to ensure that the new options don't cause functional or performance regressions for regular workloads that don't exceed the virtual address space. I also ran some tests with Firefox and was positively surprised to see that this still works on the VMSPLIT_2G_OPT configuration without highmem, though it gets close to both the address space and lowmem size limits.

The change to use VMSPLIT_3G_OPT by default on Armv5 means that I could include a patch to no longer support highmem at all on VIVT caches, as suggested by Jason Gunthorpe. I also included the patch to drop HIGHPTE support now, as suggested by David Hildenbrand.

The patches from this series are available in [4] for testing.

Once there are no further concerns about the contents, I would suggest merging this through the asm-generic tree, as it touches mostly architecture specific code and that is not easily split from the core mm/* code. Merging everything through the mm tree would of course also work.

Arnd

[1] https://lore.kernel.org/all/[email protected]/ # v1
[2] https://lore.kernel.org/all/[email protected]/ # v2
[3] https://lwn.net/Articles/1051010/
[4] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=highmem-7.4

Changes since v2:

- Add preparation patch for Arm PXA [sashiko-bot]
- Add preparation patch for powerpc32/kvm [sashiko-bot]
- Fix Arm ARCH_MMAP_RND_BITS_MAX calculation [sashiko-bot]
- Simplification for pte_alloc_one() [Mike Rapoport]
- Drop stale references to highpte [David Hildenbrand]
- improve __print_bad_page_map_pgtable()
- Split out Arm changes for CONFIG_VMSPLIT_2G_OPT

Changes since v1:
- rebase to v7.4-rc
- add patch to drop highpte

Arnd Bergmann (10):
ARM: remove support for highmem on VIVT
ARM: drop CONFIG_HIGHPTE support
ARM: pxa: support arbitrary PAGE_OFFSET
powerpc: kvm: allow flexible PAGE_OFFSET
arch/*: increase lowmem size to avoid highmem use
ARM: add CONFIG_VMSPLIT_2G_OPT option
ARM: defconfig: turn off highmem in favor of CONFIG_VMSPLIT_2G_OPT
mm: remove ARCH_NEEDS_KMAP_HIGH_GET
mm: drop HIGHPTE support altogether
mm: print pte in __print_bad_page_map_pgtable()

 arch/arm/Kconfig                            |  27 +++---
 arch/arm/configs/aspeed_g5_defconfig        |   3 +-
 arch/arm/configs/gemini_defconfig           |   1 -
 arch/arm/configs/lpae.config                |   1 +
 arch/arm/configs/multi_v5_defconfig         |   1 -
 arch/arm/configs/multi_v7_defconfig         |   1 +
 arch/arm/configs/mvebu_v5_defconfig         |   1 -
 arch/arm/configs/omap2plus_defconfig        |   1 +
 arch/arm/configs/u8500_defconfig            |   1 -
 arch/arm/configs/vt8500_v6_v7_defconfig     |   2 -
 arch/arm/include/asm/highmem.h              |  56 +----------
 arch/arm/include/asm/pgalloc.h              |  13 +--
 arch/arm/mach-omap2/Kconfig                 |   1 -
 arch/arm/mach-pxa/pxa3xx.c                  |   2 +-
 arch/arm/mm/cache-feroceon-l2.c             |  31 +-----
 arch/arm/mm/cache-xsc3l2.c                  |  47 +--------
 arch/arm/mm/dma-mapping.c                   |  12 +--
 arch/arm/mm/flush.c                         |  19 +---
 arch/microblaze/Kconfig                     |   9 +-
 arch/microblaze/configs/mmu_defconfig       |   1 -
 arch/powerpc/Kconfig                        |  24 +++--
 arch/powerpc/configs/44x/akebono_defconfig  |   1 -
 arch/powerpc/configs/85xx/ksi8560_defconfig |   1 -
 arch/powerpc/configs/85xx/stx_gp3_defconfig |   1 -
 arch/powerpc/kvm/book3s_32_sr.S             |   4 +-
 arch/powerpc/kvm/booke_interrupts.S         |   4 +-
 arch/powerpc/kvm/e500_mmu_host.c            |   3 +-
 arch/x86/Kconfig                            |   4 +-
 include/linux/hugetlb.h                     |   5 +-
 include/linux/mm.h                          |   1 -
 include/linux/pgtable.h                     |  13 ---
 mm/highmem.c                                | 100 ++------------------
 mm/memory.c                                 |  21 ++--
 mm/pgtable-generic.c                        |  25 +++--
 mm/userfaultfd.c                            |   6 +-
 35 files changed, 104 insertions(+), 339 deletions(-)
Signature · 29 lines
2.53.0

Cc: Andreas Larsson <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Christophe Leroy (CS GROUP) <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: David Hildenbrand (Arm) <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Lorenzo Stoakes (ARM) <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Malin Jonsson <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Nishanth Menon <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Russell King <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]