Re: memcpy() performance query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Can anyone tell me the performance effect in the following case:
> 1) copying data directly to mmapped memory usingmemcpy() in user space .
> 2) copying the data in the IOCTL call which in turn copies from user space to the kernel space buffer(copy_from_user).
 
 
Both perform similarly for low bandwidth of  data xfer.
 
But if u r using a high data xfer appl, such as a disk read,
or typically video streaming..( thats why u hv framebuffers ) mmap scores.
 
If u see mmap, uve these operations for data xfer:
1,  mmap the buffer. preferably u allocate large enough buffer and  do
remap_page_range() { there is a limitation of 128k bytes though }
Else u do through nopage handlers { which adds some overhead for
page faults }
 
2. Then u do direct read/writes to the buffer.
 
 
In case if copy_*_user, u do
1. fill the buffer in appl space ( which may involve swapping.. )
2. do verify_area() in copy_*_user()
3. do actual copy.
 
Almost 2 times data xfer ( or more if u hv swapping )
 
More over u can do non blocking read/writes more effectively
with mmaped memory.
 
*** CORRECT ME IF IM WRONG ANYWHERE ****  
 
more comments.. ?
 
-nagaraj
\(*_*)/
 

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux