From: Jamie Lokier <jamie@xxxxxxxxxxxxx> Date: Fri, 23 Dec 2005 05:12:54 +0000 > A variant on my problem is when using sendfile() to send from a > shared-memory file. The idea is to prepare data in mapped shared > memory, and then sendfile() it so that it doesn't have to be copied > out from userspace. I haven't actually tried this, but I think it > might improve performance where large blocks of data are involved, > especially when the same data is sent on many sockets (e.g. cached > generated web pages), and certainly would reduce memory usage. Yes, I've suggested this scheme to some people in the past. It's a clean way to get zerocopy sendmsg(), the user does all of the buffer management with some minimal help from the kernel. > It has the same problem: when to recycle pages in userspace. I guess the trick to this problem is to find some way to poll() for these events. One idea is to use a socket option to tell TCP "don't signal POLLOUT until X". So you do all of your writes, make the socket option call to say which buffer you want to wait to be free, then poll(). Patches (especially tested ones with a real app) are welcome :-) -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/