> There are three types of zones: > 1. The first four zones partition the physical address space of CPU > memory. > 2. The device zone provides interoperability between CPU and device > memory. > 3. The movable zone commonly represents a memory allocation policy. > > + > +static void __init find_virt_zone(unsigned long occupied, unsigned long *zone_pfn) > +{ > + int i, nid; > + unsigned long node_avg, remaining; Hi Yu, I discovered that CMA can be part of virtual zones. For example: Node 0, zone NoMerge pages free 35945 nr_free_pages 35945 ... nr_free_cma 8128 pagesets CMA used to be available for order-0 anonymous allocations, and the Android kernel even prioritized it by commit[1] "ANDROID: cma: redirect page allocation to CMA" /* * Used during anonymous page fault handling. */ struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma, unsigned long vaddr) { gfp_t flags = GFP_HIGHUSER_MOVABLE | __GFP_ZERO | __GFP_CMA; /* * If the page is mapped with PROT_MTE, initialise the tags at the * point of allocation and page zeroing as this is usually faster than * separate DC ZVA and STGM. */ if (vma->vm_flags & VM_MTE) flags |= __GFP_ZEROTAGS; return vma_alloc_folio(flags, 0, vma, vaddr, false); } I wonder if cma is still available to order-0 when it is located in the nomerge/nosplit zone. And while dma_alloc_coherent() or similar APIs want to get contiguous memory from cma, are they still as easy as before if cma is a part of virt zones? [1] https://android.googlesource.com/kernel/common/+/1c8aebe4c072bf18409cc78fc84407e24a437302 Thanks Barry