linux/arch/loongarch/mm
Huacai Chen ce5ad03e45 LoongArch: Consolidate max_pfn & max_low_pfn calculation
Now there 5 places which calculate max_pfn & max_low_pfn:
1. in fdt_setup() for FDT systems;
2. in memblock_init() for ACPI systems;
3. in init_numa_memory() for NUMA systems;
4. in arch_mem_init() to recalculate for "mem=" cmdline;
5. in paging_init() to recalculate for NUMA systems.

Since memblock_init() is called both for ACPI and FDT systems, move the
calculation out of the for_each_efi_memory_desc() loop can eliminate the
first case. The last case is very questionable (may be derived from the
MIPS/Loongson code) and breaks the "mem=" cmdline, so should be removed.
And then the NUMA version of paging_init() can be also eliminated.

After consolidation there are 3 places of calculation:
1. in memblock_init() for both ACPI and FDT systems;
2. in init_numa_memory() to recalculate for NUMA systems;
3. in arch_mem_init() to recalculate for the "mem=" cmdline.

For all cases the calculation is:
max_pfn = PFN_DOWN(memblock_end_of_DRAM());
max_low_pfn = min(PFN_DOWN(HIGHMEM_START), max_pfn);

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
History 2025-11-10 08:37:06 +08:00
..
cache.c LoongArch: Remove shm_align_mask and use SHMLBA instead 2023-09-06 22:53:09 +08:00
extable.c LoongArch: BPF: Add BPF exception tables 2022-12-14 08:36:11 +08:00
fault.c LoongArch: Try VMA lock-based page fault handling first 2025-10-02 22:39:19 +08:00
hugetlbpage.c LoongArch: Fix panic caused by NULL-PMD in huge_pte_offset() 2025-05-30 21:45:57 +08:00
init.c LoongArch: Consolidate max_pfn & max_low_pfn calculation 2025-11-10 08:37:06 +08:00
ioremap.c LoongArch: Consolidate early_ioremap()/ioremap_prot() 2025-11-10 08:37:06 +08:00
kasan_init.c kasan: introduce ARCH_DEFER_KASAN and unify static key across modes 2025-09-21 14:21:58 -07:00
maccess.c LoongArch: Add memory management 2022-06-03 20:09:28 +08:00
Makefile LoongArch: Add ARCH_HAS_SET_MEMORY support 2024-09-24 15:32:20 +08:00
mmap.c LoongArch: Set hugetlb mmap base address aligned with pmd size 2025-03-08 13:51:32 +08:00
page.S LoongArch: Replace #include <asm/export.h> with #include <linux/export.h> 2023-08-25 23:40:26 +08:00
pageattr.c mm/pagewalk: split walk_page_range_novma() into kernel/user parts 2025-07-09 22:42:05 -07:00
pgtable.c arch: remove mk_pmd() 2025-05-11 17:48:04 -07:00
tlb.c LoongArch: Fix sleeping in atomic context for PREEMPT_RT 2024-11-26 18:06:04 +08:00
tlbex.S LoongArch: Give a chance to build with !CONFIG_SMP 2024-05-14 12:24:18 +08:00