* [PATCH] sock_writeable not appropriate for TCP sockets, for 2.4.20
@ 2002-08-30 20:51 Chuck Lever
2002-08-30 21:28 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Chuck Lever @ 2002-08-30 20:51 UTC (permalink / raw)
To: marcelo; +Cc: Linux Kernel Mailing List, Linux NFS List
hi marcelo-
sock_writeable determines whether there is space in a socket's output
buffer. socket write_space callbacks use it to determine whether to wake
up those that are waiting for more output buffer space.
however, sock_writeable is not appropriate for TCP sockets. because the
RPC layer's write_space callback uses it for TCP sockets, the RPC layer
hammers on sock_sendmsg with dozens of write requests that are only a few
hundred bytes long when it is trying to send a large write RPC request.
this patch adds logic to the RPC layer's write_space callback that
properly handles TCP sockets.
patch reviewed by Trond and Alexey. patch already sent to linus for 2.5.
--- 2.4.20-pre5/net/sunrpc/xprt.c.orig Fri Aug 30 15:49:28 2002
+++ 2.4.20-pre5/net/sunrpc/xprt.c Fri Aug 30 15:52:55 2002
@@ -950,6 +950,8 @@
/*
- * The following 2 routines allow a task to sleep while socket memory is
- * low.
+ * Called when more output buffer space is available for this socket.
+ * We try not to wake our writers until they can make "significant"
+ * progress, otherwise we'll waste resources thrashing sock_sendmsg
+ * with a bunch of small requests.
*/
static void
@@ -965,6 +967,13 @@
/* Wait until we have enough socket memory */
- if (!sock_writeable(sk))
- return;
+ if (xprt->stream) {
+ /* from net/ipv4/tcp.c:tcp_write_space */
+ if (tcp_wspace(sk) < tcp_min_write_space(sk))
+ return;
+ } else {
+ /* from net/core/sock.c:sock_def_write_space */
+ if (!sock_writeable(sk))
+ return;
+ }
if (!test_and_clear_bit(SOCK_NOSPACE, &sock->flags))
--
corporate: <cel at netapp dot com>
personal: <chucklever at bigfoot dot com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sock_writeable not appropriate for TCP sockets, for 2.4.20
2002-08-30 20:51 [PATCH] sock_writeable not appropriate for TCP sockets, for 2.4.20 Chuck Lever
@ 2002-08-30 21:28 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2002-08-30 21:28 UTC (permalink / raw)
To: cel; +Cc: marcelo, linux-kernel, nfs
From: Chuck Lever <cel@citi.umich.edu>
Date: Fri, 30 Aug 2002 16:51:57 -0400 (EDT)
patch reviewed by Trond and Alexey. patch already sent to linus for 2.5.
I think this patch should go in too.
--- 2.4.20-pre5/net/sunrpc/xprt.c.orig Fri Aug 30 15:49:28 2002
+++ 2.4.20-pre5/net/sunrpc/xprt.c Fri Aug 30 15:52:55 2002
Franks a lot,
David S. Miller
davem@redhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-30 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-30 20:51 [PATCH] sock_writeable not appropriate for TCP sockets, for 2.4.20 Chuck Lever
2002-08-30 21:28 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®