[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Zero-copy transfer with kiobufs: URGENT
Hi,
The following works for me:
1) User space calls kernel-based function which:
a) creates a Virtual Memory Area of say 64KB. do_mmap_pgoff()
returning address and then call find_vma() to get the actual vma.
b) does a pvKernelMem = __get_free_pages(up to 128KB I believe) to
allocate contiguous kernel pages. Note, kmalloc() does not always
end up being page-aligned. Save pvKernelMem for kernel access to shared
memory.
c) Map the user VMA to the kernel pages using: set_page_reserved()
on all pages then remap_page_range().
d) return VMA->vm_start to the user to denote the beginning address
of the shared memory.
2) Use memory. Suggest you specify "volatile" on variables utilizing such
shared memory to avoid compiler optimization related
issues.
3) Have a "Close" function unmap by using do_munmap() and free kernel pages.
Stuart
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/