linux kernel - mmap() slower than write() copy_form_user(), why? -
i need transfer big blocks of data (~6mb) driver user space. in driver, allocate 2 3mb chunks per block using pci_alloc_consistent(). mmap() each block (i.e. 2 chunks) single vma using vm_insert_page(). allows user space read/write each block after mmap'ing it. seems work performance not acceptable.
i implemented way of writing/reading to/from memory allocated pci_alloc_consistent() in driver. use write() user space , copy_from_user() in driver move content of each chunk in block above memory. opposite reads.
i found first approach @ least 2-3 times slower , used ~40% more cpu. expected introduction of additional buffer copy in second case make slower. however, not case.
i ran thest tests on x86 64-bit platforms, kernels: 2.6.* , 3.*.
do above results make sense? if yes, can please provide background on taking place?
thanks.
caching disabled. did ioremap_cache() chunks allocated , vm_inserted? iv come across kind of problem on x86/x86_64 , has pat(page attribute table). need ioremap_cache() physical pages set memory type cache-able , call vm_insert_page. should fix performance issue.
Comments
Post a Comment