What is the difference between copying from user space buffer to kernel space buffer and, mapping user space buffer to kernel space buffer and then copying kernel space buffer to another kernel data structure?
What I meant to say is:
The first method is
copy_from_user()
function.The second method is say, a user space buffer is mapped to kernel space and the kernel is passed with physical address(say using
/proc/self/pagemap
), then kernel space callsphys_to_virt()
on the passed physical address to get it's corresponding kernel virtual address. Then kernel copies the data from one of its data structures sayskb_buff
to the kernel virtual address it got from the call tophys_to_virt()
call.Note:
phys_to_virt()
adds an offset of0xc0000000
to the passed physical address to get kernel virtual address, right?
The second method describes the functionality in DPDK for KNI module and they say in documentation that it eliminates the overhead of copying from user space to kernel space. Please explain me how.