x86-remove-unneeded-memblock_find_dma_reserve.patch removed from -mm tree
The quilt patch titled
Subject: x86: remove unneeded memblock_find_dma_reserve()
has been removed from the -mm tree. Its filename was
x86-remove-unneeded-memblock_find_dma_reserve.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baoquan He <[email protected]>
Subject: x86: remove unneeded memblock_find_dma_reserve()
Date: Mon, 25 Mar 2024 22:56:41 +0800
Patch series "mm/mm_init.c: refactor free_area_init_core()".
In function free_area_init_core(), the code calculating zone->managed_pages and the subtracting dma_reserve from DMA zone looks very confusing.
From git history, the code calculating zone->managed_pages was for zone->present_pages originally. The early rough assignment is for optimize zone's pcp and water mark setting. Later, managed_pages was introduced into zone to represent the number of managed pages by buddy. Now, zone->managed_pages is zeroed out and reset in mem_init() when calling memblock_free_all(). zone's pcp and wmark setting relying on actual zone->managed_pages are done later than mem_init() invocation. So we don't need rush to early calculate and set zone->managed_pages, just set it as zone->present_pages, will adjust it in mem_init().
And also add a new function calc_nr_kernel_pages() to count up free but not reserved pages in memblock, then assign it to nr_all_pages and nr_kernel_pages after memmap pages are allocated.
This patch (of 6):
Variable dma_reserve and its usage was introduced in commit 0e0b864e069c ("[PATCH] Account for memmap and optionally the kernel image as holes"). Its original purpose was to accounting for the reserved pages in DMA zone to make DMA zone's watermarks calculation more accurate on x86.
However, currently there's zone->managed_pages to account for all available pages for buddy, zone->present_pages to account for all present physical pages in zone. What is more important, on x86, calculating and setting the zone->managed_pages is a temporary move, all zone's managed_pages will be zeroed out and reset to the actual value according to how many pages are added to buddy allocator in mem_init(). Before mem_init(), no buddy alloction is requested. And zone's pcp and watermark setting are all done after mem_init(). So, no need to worry about the DMA zone's setting accuracy during free_area_init().
Hence, remove memblock_find_dma_reserve() to stop calculating and setting dma_reserve.
---
arch/x86/include/asm/pgtable.h | 1 arch/x86/kernel/setup.c | 2 - arch/x86/mm/init.c | 47 ------------------------------- 3 files changed, 50 deletions(-)
arch/x86/include/asm/pgtable.h renamed from arch/x86/include/asm/pgtable.h~x86-remove-unneeded-memblock_find_dma_reserve +0 -1
@@ -1200,7 +1200,6 @@ static inline int pgd_none(pgd_t pgd)extern int direct_gbpages;void init_mem_mapping (void );void early_alloc_pgt_buf (void ); -extern void memblock_find_dma_reserve (void );void __init poking_init (void );unsigned long init_memory_mapping (unsigned long start,unsigned long end,pgprot_t prot);
arch/x86/kernel/setup.c renamed from arch/x86/kernel/setup.c~x86-remove-unneeded-memblock_find_dma_reserve +0 -2
@@ -1107,8 +1107,6 @@ void __init setup_arch(char **cmdline_p)*/ arch_reserve_crashkernel (); -memblock_find_dma_reserve (); -if (!early_xdbc_setup_hardware ())early_xdbc_register_console ();
arch/x86/mm/init.c renamed from arch/x86/mm/init.c~x86-remove-unneeded-memblock_find_dma_reserve +0 -47
53 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
documentation-kdump-clean-up-the-outdated-description.patch kexec-fix-the-unexpected-kexec_dprintk-macro.patch crash-add-prefix-for-crash-dumping-messages.patch