Date: Wed, 19 Jul 2006 23:16:55 -0400 From: Mikhail Teterin <mi+mx@aldan.algebra.com> To: "David G. Lawrence" <dg@dglawrence.com> Cc: net@freebsd.org Subject: Re: complement to sendfile()? Message-ID: <200607192316.56157.mi%2Bmx@aldan.algebra.com> In-Reply-To: <20060720025003.GF924@tnn.dglawrence.com> References: <200607192230.14939.mi%2Bmx@aldan.algebra.com> <20060720025003.GF924@tnn.dglawrence.com>
next in thread | previous in thread | raw e-mail | index | archive | help
ÓÅÒÅÄÁ 19 ÌÉÐÅÎØ 2006 22:50, David G. Lawrence ÎÁÐÉÓÁ×: > š šsendfile() could be extended to allow arbitrary file descriptor types as > the source and destination, but the zero-copy nature of it can only work > in the file to socket direction. This is because network buffers can be > made out of filesystem buffers (file->network direction), but for the > network to file direction network packets arrive non-deterministically. > With the right network hardware it would in theory be possible to have the > TCP code run on the network card and it could DMA the TCP stream directly > into file buffers. If pigs had wings, they could fly. :-) Ok, so zero-copy may not work, but one-copy would still be better, than the usual two-copy. Am I right? With the usual read/write method, data is read from the network card to kernel's buffers, from there to the application buffer, and from there to the filesystem. That's two copies, no? Having mmap-ed the output file, I could read from the socket directly into the mmap-returned "buffer", but writing via. mmap appears to be implemented pessimally in FreeBSD and breaks horrendously if the output file happens to be accessed via NFS. Thanks! -mi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607192316.56157.mi%2Bmx>