Dave, But in the case of the user making a temp file, mmaping it, writing to the mmaped area and then using sendfile, we are not saving any copy. Is'nt this the same like, user passing a buffer to sendmsg(). This buffer gets copied to an skbuff (equivalent to user data being written in the page cache). Now from this point onwards both sendfile and sendmsg have the same overhead. How am I gaining using sendfile, unless the same data has to be sent more than once, in which case the sendfile() approach will benefit by not having to copy the data from user space 2nd (and consecutive) time around. Also true for Jeff's ramfs approach. Thanx tomar On Fri, 15 Aug 2003, David S. Miller wrote: > On Wed, 13 Aug 2003 21:43:41 +0530 (IST) > Nagendra Singh Tomar <nagendra_tomar@adaptec.com> wrote: > > > So this means that this Zero Copy can only be used by senders who > > have to send data from a "file" that supports mmap. > > No, a "file" that supports specifically sendfile(). > > > I just can't > > fill a buffer in userland and expect it to be sent via Zero Copy. > > Sure you can, create a temporary file, mmap() it into your > address space, use that mmap()'d area as a local buffer > and use sendfile() on that file to send the data over the socket. > - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html