linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mike Rapoport <rppt@kernel.org>
Subject: Re: [PATCH -next] mm: page_alloc: simplify has_managed_dma()
Date: Tue, 30 May 2023 12:18:44 +0800	[thread overview]
Message-ID: <ZHV5JCINq6fc/SG9@MiWiFi-R3L-srv> (raw)
In-Reply-To: <38ea4ea3-cd7f-abf4-e992-2f748e3b1fcb@huawei.com>

On 05/30/23 at 10:10am, Kefeng Wang wrote:
> 
> 
> 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/'

willy is right. max_zone_pfn can only limit the range of zone, but
can't decide which zone is put on which node. The memory layout is
decided by firmware. I searched commit log to get below commit which
can give a good example.

commit c1d0da83358a2316d9be7f229f26126dbaa07468
Author: Laurent Dufour <ldufour@linux.ibm.com>
Date:   Fri Sep 25 21:19:28 2020 -0700

    mm: replace memmap_context by meminit_context
    
    Patch series "mm: fix memory to node bad links in sysfs", v3.
    
    Sometimes, firmware may expose interleaved memory layout like this:
    
     Early memory node ranges
       node   1: [mem 0x0000000000000000-0x000000011fffffff]
       node   2: [mem 0x0000000120000000-0x000000014fffffff]
       node   1: [mem 0x0000000150000000-0x00000001ffffffff]
       node   0: [mem 0x0000000200000000-0x000000048fffffff]
       node   2: [mem 0x0000000490000000-0x00000007ffffffff]

> 
> 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;
> 



  reply	other threads:[~2023-05-30  4:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 14:40 Kefeng Wang
2023-05-29 14:26 ` Matthew Wilcox
2023-05-30  2:10   ` Kefeng Wang
2023-05-30  4:18     ` Baoquan He [this message]
2023-05-30  6:40       ` Kefeng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZHV5JCINq6fc/SG9@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox