Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK

From: Evgeniy Polyakov
Date: Fri Jul 18 2008 - 08:24:31 EST


On Fri, Jul 18, 2008 at 02:18:59PM +0300, Octavian Purdila (opurdila@xxxxxxxxxxx) wrote:
> I know that. But I am arguing that splice API does not required not to block
> even when the SPLICE_F_NONBLOCK is used. So changing this behavior the way I
> suggested will still be conformant with the splice API requirements.

It will block in sending and/or other than network reading. With your
patch if receiving socket was opened in blocking mode, than there is no
way to finish splice-in until whole requested number of bytes are read.
SPLICE_F_NONBLOCK is an extension, consider it like recv() with temporal
non-blocking flag.

> Sorry, it was an unfortunate example :) This is not about not enough data
> being available. Lets change the number of packets in the example with 20
> instead of 16 (and keep the size to 17) - the splice call will still block
> because of the pipe being full. The pipe can only hold PIPE_BUFFERS packets
> (which is 16 currently).

Why? It will read its data from 16 packets, then send them into another end
of the pipe :)

You propose to change a very useful splice feature (actually you would just
remove it at all with the same results for reading network path, since
it is essentially what you did :) - not to block when it is possible.

This kind of non-blocking mode was added for performance issues too:
consider application which reads from the network and writes into the
file, while there is no data in the socket it can write what was already
read into any object attached to the given end of the pipe.

--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/