Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc: introduce arch_zone_limits_init()

Move calculations of zone limits to a dedicated arch_zone_limits_init()
function.

Later MM core will use this function as an architecture specific callback
during nodes and zones initialization and thus there won't be a need to
call free_area_init() from every architecture.

Link: https://lkml.kernel.org/r/20260111082105.290734-16-rppt@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Klara Modin <klarasmodin@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Mike Rapoport (Microsoft) and committed by
Andrew Morton
27bebe44 950696af

+12 -10
+12 -10
arch/powerpc/mm/mem.c
··· 221 221 * anyway) will take a first dip into ZONE_NORMAL and get otherwise served by 222 222 * ZONE_DMA. 223 223 */ 224 - static unsigned long max_zone_pfns[MAX_NR_ZONES]; 224 + void __init arch_zone_limits_init(unsigned long *max_zone_pfns) 225 + { 226 + #ifdef CONFIG_ZONE_DMA 227 + max_zone_pfns[ZONE_DMA] = min((zone_dma_limit >> PAGE_SHIFT) + 1, max_low_pfn); 228 + #endif 229 + max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 230 + #ifdef CONFIG_HIGHMEM 231 + max_zone_pfns[ZONE_HIGHMEM] = max_pfn; 232 + #endif 233 + } 225 234 226 235 /* 227 236 * paging_init() sets up the page tables - in fact we've already done this. 228 237 */ 229 238 void __init paging_init(void) 230 239 { 240 + unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0 }; 231 241 unsigned long long total_ram = memblock_phys_mem_size(); 232 242 phys_addr_t top_of_ram = memblock_end_of_DRAM(); 233 243 int zone_dma_bits; ··· 269 259 270 260 zone_dma_limit = DMA_BIT_MASK(zone_dma_bits); 271 261 272 - #ifdef CONFIG_ZONE_DMA 273 - max_zone_pfns[ZONE_DMA] = min(max_low_pfn, 274 - 1UL << (zone_dma_bits - PAGE_SHIFT)); 275 - #endif 276 - max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 277 - #ifdef CONFIG_HIGHMEM 278 - max_zone_pfns[ZONE_HIGHMEM] = max_pfn; 279 - #endif 280 - 262 + arch_zone_limits_init(max_zone_pfns); 281 263 free_area_init(max_zone_pfns); 282 264 283 265 mark_nonram_nosave();