Subject: Re: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING

From: Evgeniy Polyakov <[email-masked]>
Date: Wed, 12 Nov 2008 21:11:34 +0300

On Wed, Nov 12, 2008 at 09:59:20AM -0800, Lovich, Vitali ([email-masked]) wrote:
> They aren't racy - not in the sense that your suggestion would make it.  With current splice & sendfile, when it returns from the syscall, the user knows that it has been transmitted and thus can continue using the file descriptors & memory (in the case of vmsplice).  However, with your suggestion, the user could actually never know when it's safe to write into memory (even in a single-threaded situation).  Thus it is racy in a single-threaded situation (even on a UP it's potentially racy) which is a pretty amazing feat.  Consider:

Problem is, that when sendfile() returns nothing has been transferred.
And in some NICs it will take a while to actually make a transfer.
And what you wrote below is exactly the same problem as exists with
splice/sendfile in particular and ->sendpage() in general.

Please also update your mailer to wrap strings into 80-or-so lines, it
is hard to answer into the middle of the paragraph.

-- 
	Evgeniy Polyakov