Re: [PATCH] tcp: splice as many packets as possible at once

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <dada1@...>
Cc: <ben@...>, <w@...>, <jarkao2@...>, <mingo@...>, <linux-kernel@...>, <netdev@...>, <jens.axboe@...>
Date: Tuesday, January 13, 2009 - 7:26 pm

From: Eric Dumazet
Date: Fri, 09 Jan 2009 07:47:16 +0100

> I found this patch usefull in my testings, but had a feeling something

Spice read does not handle SO_RCVLOWAT like tcp_recvmsg() does.

We should probably add a:

target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);

and check 'target' against 'spliced' in the main loop of
tcp_splice_read().

> About tcp_recvmsg(), we might also remove the "!timeo" test as well,

I sometimes have a suspicion we can remove this test too, but it's
not really that clear.

If an application is doing non-blocking reads and they care about
latency, they shouldn't be providing huge buffers. This much I
agree with, but...

If you look at where this check is placed in the recvmsg() case, it is
done after we have verified that there is no socket backlog.

if (copied >= target && !sk->sk_backlog.tail)
break;

if (copied) {
if (sk->sk_err ||
sk->sk_state == TCP_CLOSE ||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
!timeo ||
signal_pending(current))
break;
} else {

So either:

1) We haven't met the target. And note that target is one unless
the user makes an explicit receive low-water setting.

2) Or there is no backlog.

When we get to the 'if (copied)' check.

You can view this "!timeo" check as meaning "non-blocking". When
we get to it, we are guarenteed that we haven't met the target
and we have no backlog. So it is absolutely appropriate to break
out of recvmsg() processing here if non-blocking.

There is a lot of logic and feature handling in tcp_splice_read() and
that's why the semantics of "!timeo" cases are not being handled
properly here.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] tcp: splice as many packets as possible at once, Willy Tarreau, (Thu Jan 8, 1:30 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, David Miller, (Tue Jan 13, 7:26 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Fri Jan 9, 6:42 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 8:58 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 9:35 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Sun Jan 11, 12:05 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 13, 8:13 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 13, 8:22 pm)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 4:53 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Tue Jan 20, 4:37 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Fri Jan 16, 2:51 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Tue Jan 20, 8:11 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Tue Jan 20, 10:06 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Mon Jan 19, 4:40 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Mon Jan 26, 3:59 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 5:54 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 8:15 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 8:06 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 5:42 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 6:47 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 7:40 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Jarek Poplawski, (Wed Jan 14, 7:45 am)
Re: [PATCH] tcp: splice as many packets as possible at once, Evgeniy Polyakov, (Fri Jan 9, 7:01 pm)
[PATCH] tcp: splice as many packets as possible at once, Willy Tarreau, (Thu Jan 8, 4:16 pm)