I would like to use udp_sendpage in order to transmit user-supplied data.
My first idea was to lock the pages holding the user buffers and use
those directly. However, I don't know how to obtain a page based on a
user-space virtual address (as opposed to page_from_virt, which works on
kernel virtual addresses). Question number 1 is, therefore, whether it
is possible to obtain and lock such a page.
In the meantime, I have decided to copy the supplied buffers into
kernel-allocated pages and use those. I allocate the required order of
pages using alloc_pages(), copy up to PAGE_SIZE into each page, and then
iterate over the used pages, calling udp_sendpage for each of those.
Unfortunately, when I try to free the pages at the end of the function,
I get a bad_page error, indicating the page counts are non-zero. I
checked ip_append_data(), which allocates pages for SG I/O, but does not
free them. Hence question 2: Why are these pages still in use after
udp_sendpage returns, and how are these pages supposed to be released?
Thanks,
Elad
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/