Re: [PATCH -next] mm: page_alloc: simplify has_managed_dma()
From: Kefeng Wang
Date: Mon May 29 2023 - 22:11:05 EST
On 2023/5/29 22:26, Matthew Wilcox wrote:
On Mon, May 29, 2023 at 10:40:22PM +0800, Kefeng Wang wrote:
The ZONE_DMA should only exists on Node 0, only check NODE_DATA(0)
is enough, so simplify has_managed_dma() and make it inline.
That's true on x86, but is it true on all architectures?
There is no document about numa node info for the DMA_ZONE, + Mike
I used 'git grep -w ZONE_DMA arch/'
1) the following archs without NUMA support, so it's true for them,
arch/alpha/mm/init.c: max_zone_pfn[ZONE_DMA] = dma_pfn;
arch/arm/mm/init.c: max_zone_pfn[ZONE_DMA] = min(arm_dma_pfn_limit,
max_low);
arch/m68k/mm/init.c: max_zone_pfn[ZONE_DMA] = end_mem >> PAGE_SHIFT;
arch/m68k/mm/mcfmmu.c: max_zone_pfn[ZONE_DMA] = PFN_DOWN(_ramend);
arch/m68k/mm/motorola.c: max_zone_pfn[ZONE_DMA] = memblock_end_of_DRAM();
arch/m68k/mm/sun3mmu.c: max_zone_pfn[ZONE_DMA] = ((unsigned
long)high_memory) >> PAGE_SHIFT;
arch/microblaze/mm/init.c: zones_size[ZONE_DMA] = max_low_pfn;
arch/microblaze/mm/init.c: zones_size[ZONE_DMA] = max_pfn;
2) Simple check following archs, it seems that it is yes to them too.
arch/mips/mm/init.c: max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
arch/powerpc/mm/mem.c: max_zone_pfns[ZONE_DMA] = min(max_low_pfn,
arch/s390/mm/init.c: max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS);
arch/sparc/mm/srmmu.c: max_zone_pfn[ZONE_DMA] = max_low_pfn;
arch/x86/mm/init.c: max_zone_pfns[ZONE_DMA] = min(MAX_DMA_PFN,
max_low_pfn);
arch/arm64/mm/init.c: max_zone_pfns[ZONE_DMA] =
PFN_DOWN(arm64_dma_phys_limit);
arch/loongarch/mm/init.c: max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;