2008-06-01 23:52:08

by Octavian Purdila

[permalink] [raw]
Subject: [RFC] [PATCH] tcp_splice_read: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK

This patch stops propagating SPLICE_F_NONBLOCK as O_NONBLOCK to the
underlaying socket. It follows the man page semantic - or at least my
interpretation.

This approach also provides a simple solution to the splice transfer size
problem. Say we have the following common sequence:

splice(socket, pipe);
splice(pipe, file);

Unless we specify SPLICE_F_NONBLOCK, we can't use arbitrarily large size
transfers with the 1st splice since otherwise we will deadlock due to
pipe "fullness". But if we use SPLICE_F_NONBLOCK, the current implementation
will make the underlying socket non-blocking and thus will force us use poll
or other notification mechanism.

Choosing a splice transfer size so that we don't deadlock is tricky: we want
to use a large value to improve performance (less system calls) and at the
same time we need to stay under PIPE_BUFFERS packets. Fragmentation / MTU
complicates this equation further.


tavi


Attachments:
(No filename) (936.00 B)