Why would it fail to init? If CMA allocation fails, the kernel will fulfill the request using alloc_pages_node():
struct page *__dma_direct_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) { [...] /* CMA can be used only in the context which permits sleeping */ if (gfpflags_allow_blocking(gfp)) { page = dma_alloc_from_contiguous(dev, count, page_order, gfp & __GFP_NOWARN); if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) { dma_release_from_contiguous(dev, page, count); page = NULL; } } if (!page) page = alloc_pages_node(dev_to_node(dev), gfp, page_order); [...] }
Why would it fail to init? If CMA allocation fails, the kernel will fulfill the request using alloc_pages_node():
struct page *__dma_ direct_ alloc_pages( struct device *dev, size_t size, allow_blocking( gfp)) { from_contiguous (dev, count, page_order, ok(dev, page_to_phys(page), size)) { release_ from_contiguous (dev, page, count); node(dev_ to_node( dev), gfp, page_order);
dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
{
[...]
/* CMA can be used only in the context which permits sleeping */
if (gfpflags_
page = dma_alloc_
gfp & __GFP_NOWARN);
if (page && !dma_coherent_
dma_
page = NULL;
}
}
if (!page)
page = alloc_pages_
[...]
}