[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200807182004.44664.opurdila@ixiacom.com>
Date: Fri, 18 Jul 2008 20:04:44 +0300
From: Octavian Purdila <opurdila@...acom.com>
To: Evgeniy Polyakov <johnpol@....mipt.ru>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
axboe@...nel.dk
Subject: Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK
On Friday 18 July 2008, Evgeniy Polyakov wrote:
> > It will take 17 because this is what the user requested. And when trying
> > to push the 17th on the pipe, it will block. I base this both on
> > experiments and on my understanding of the tcp splice receive
> > implementation.
>
> Seems like we do not understand each other. How it can take 17 if there
> are only 16 pages? By 'push' you mean splice-into-pipe or
> splice-out-of-pipe-into-other-fd? Where exactly will it block?
>
Suppose we have 20 packets in the socket queue and the pipe is empty and the
application calls splice(sock, pipe, 17, flags=0).
Then, tcp_splice_read will be called, which in turn calls tcp_read_sock.
tcp_read_sock will loop until all the 17 bytes will be read from the socket.
tcp_read_sock calls skb_splice_bits which calls splice_to_pipe.
Now while skb_splice_bits is carefull to only put a maximum of PIPE_BUFFERS
during its iteration, due to the looping in tcp_read_sock, we will end up
with 17 calls to splice_to_pipe. Thus on the 17th call, splice_to_pipe will
block.
Does this make sense?
Thanks,
tavi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists