When I develop a PCIE driver on TX2 ,I found a problem when copy data from mmap() memory aera to normal memory(The target is
fast copy data from kernel space to user space):
unsigned long size = vma->vm_end - vma->vm_start; vma->vm_flags |= ( VM_IO | VM_DONTEXPAND | VM_DONTDUMP ); vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); if(remap_pfn_range(vma,vma->vm_start,vmalloc_to_pfn(gReadBuffer),size,vma->vm_page_prot)) printk("vmalloc_to_pfn Error! \n");
mmap_data=(unsigned char *)mmap(NULL,BUF_SIZE,PROT_READ|PROT_WRITE,MAP_PRIVATE,fd,0); memcpy(gReadData,mmap_data,BUF_SIZE);
It’s very very slow and about 110MB/s. The copy_to_user() function do the same work and 670MB/s. If I copy same size data between two normal memory, the speed is 11GB/s.
I use mmap() function and copy data from that aera, I want to speed up my copy speed but now the speed is too slow!
Anyone can help me?