On Wed, Apr 08, 2020 at 09:17:36PM +0800, Hillf Danton wrote: > > @@ -62,24 +42,20 @@ void *dma_common_pages_remap(struct page **pages, size_t size, > > void *dma_common_contiguous_remap(struct page *page, size_t size, > > pgprot_t prot, const void *caller) > > { > > - int i; > > + int count = size >> PAGE_SHIFT; > > struct page **pages; > > - struct vm_struct *area; > > + void *vaddr; > > + int i; > > > > - pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL); > > + pages = kmalloc_array(count, sizeof(struct page *), GFP_KERNEL); > > Is it making sense to vmalloc pages as long as array size is bigger than > PAGE_SIZE? Maybe, maybe not. But it certainly doesn't fit this series.