I'm writing a driver which need large memory. Let's say it will be 1GB at least. The kernel version >= 3.10. Driver needs run in X86_64 and Arm platform. The hardware may have IOMMU.
- This large memory will mmap to userspace.
- Device use those memory to do DMA. Each DMA operation just write max 2KB size of data to those memory.
My Questions.
vmalloc can give me large non-physical-continus pages. Can I use vmalloc get large memory to do DMA? I'm thinking use
vmalloc_to_page
to get page pointer then usepage_to_phys
to get physical address.I found a info about "vmalloc performance is lower than kmalloc." I'm not sure what it means. if I do
vaddr = vmalloc(2MB)
andkaddr = kmalloc(2MB)
, the function call of vmalloc will be slower than kmalloc because of memory remap. But is memory access in range [vaddr, vaddr+2MB) will slower than [kaddr, kaddr+2MB) ? The large memory will be created during driver init, so does vmalloc memory cause performance issue?DMA needs
dma_map_single
to getdma_addr_t
. I'm thinking usedma_map_single
to get all the page's dma address at driver init. I will just use those dma address when driver need to do DMA. Can I do this to get some performance improvment?