1

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.

  1. This large memory will mmap to userspace.
  2. Device use those memory to do DMA. Each DMA operation just write max 2KB size of data to those memory.

My Questions.

  1. 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 use page_to_phys to get physical address.

  2. I found a info about "vmalloc performance is lower than kmalloc." I'm not sure what it means. if I do vaddr = vmalloc(2MB) and kaddr = 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?

  3. DMA needs dma_map_single to get dma_addr_t. I'm thinking use dma_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?

randomeval
  • 599
  • 4
  • 13

0 Answers0