Skip to content

mm/highmem: don't track highmem pages manually

David Hildenbrand linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 13 repliesIn review 1 of 2 applied

Patches in v1 1 of 2 applied

#Subject and filesSizeRepliesApplied
1/2mm/highmem: reimplement totalhigh_pages() by walking zonesinclude/linux/highmem-internal.h mm/highmem.c mm/page_alloc.c+15 -143 replies
2/2mm/highmem: make nr_free_highpages() return "unsigned long"include/linux/highmem-internal.h include/linux/highmem.h mm/highmem.c+7 -79 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchWei YangOscar Salvador
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/2] mm/highmem: don't track highmem pages manually

Let's remove highmem special-casing from adjust_managed_page_count(), to result in less confusion why memblock manually adjusts totalram_pages, and __free_pages_core() only adjusts the zone's managed pages -- what about the highmem pages that adjust_managed_page_count() updates?

Now, we only maintain totalram_pages and a zone's managed pages independent of highmem support. We can derive the number of highmem pages simply by looking at the relevant zone's managed pages. I don't think there is any particular fast path that needs a maximum-efficient totalhigh_pages() implementation.

Note that highmem memory is currently initialized using free_highmem_page()->free_reserved_page(), not __free_pages_core(). In the future we might want to also use __free_pages_core() to initialize highmem memory, to make that less special, and consider moving totalram_pages updates into __free_pages_core() [1], so we can just use adjust_managed_page_count() in there as well.

Booting a simple kernel in QEMU reveals no highmem accounting change:

Before:
Memory: 3095448K/3145208K available (14802K kernel code, 2073K rwdata, 5000K rodata, 740K init, 556K bss, 49760K reserved, 0K cma-reserved, 2244488K highmem)

After:
Memory: 3095276K/3145208K available (14802K kernel code, 2073K rwdata, 5000K rodata, 740K init, 556K bss, 49932K reserved, 0K cma-reserved, 2244488K highmem)

[1] https://lkml.kernel.org/r/[email protected]

Cc Andrew Morton <[email protected]>
Cc Wei Yang <[email protected]>

David Hildenbrand (2):
mm/highmem: reimplement totalhigh_pages() by walking zones mm/highmem: make nr_free_highpages() return "unsigned long"

 include/linux/highmem-internal.h | 17 ++++++-----------
 include/linux/highmem.h          |  2 +-
 mm/highmem.c                     | 20 +++++++++++++++-----
 mm/page_alloc.c                  |  4 ----
 4 files changed, 22 insertions(+), 21 deletions(-)

base-commit: 19b8422c5bd56fb5e7085995801c6543a98bda1f

Signature · 1 line
2.45.1