diff options
author | Olga Kornievskaia <aglo@citi.umich.edu> | 2008-10-21 14:13:47 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-04-07 14:36:40 -0400 |
commit | 9660439861aa8dbd5e2b8087f33e20760c2c9afc (patch) | |
tree | 612460d547807056e10cebcd97156a555601d6c3 /net | |
parent | 31d68ef65c7d49def19c1bae4e01b87d66cf5a56 (diff) |
svcrpc: take advantage of tcp autotuning
Allow the NFSv4 server to make use of TCP autotuning behaviour, which
was previously disabled by setting the sk_userlocks variable.
Set the receive buffers to be big enough to receive the whole RPC
request, and set this for the listening socket, not the accept socket.
Remove the code that readjusts the receive/send buffer sizes for the
accepted socket. Previously this code was used to influence the TCP
window management behaviour, which is no longer needed when autotuning
is enabled.
This can improve IO bandwidth on networks with high bandwidth-delay
products, where a large tcp window is required. It also simplifies
performance tuning, since getting adequate tcp buffers previously
required increasing the number of nfsd threads.
Signed-off-by: Olga Kornievskaia <aglo@citi.umich.edu>
Cc: Jim Rees <rees@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/svcsock.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index a4fafcbc6ea0..213dea8b283c 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -436,7 +436,6 @@ static void svc_sock_setbufsize(struct socket *sock, unsigned int snd, | |||
436 | lock_sock(sock->sk); | 436 | lock_sock(sock->sk); |
437 | sock->sk->sk_sndbuf = snd * 2; | 437 | sock->sk->sk_sndbuf = snd * 2; |
438 | sock->sk->sk_rcvbuf = rcv * 2; | 438 | sock->sk->sk_rcvbuf = rcv * 2; |
439 | sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK; | ||
440 | sock->sk->sk_write_space(sock->sk); | 439 | sock->sk->sk_write_space(sock->sk); |
441 | release_sock(sock->sk); | 440 | release_sock(sock->sk); |
442 | #endif | 441 | #endif |
@@ -973,23 +972,6 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) | |||
973 | unsigned int want; | 972 | unsigned int want; |
974 | int len; | 973 | int len; |
975 | 974 | ||
976 | if (test_and_clear_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags)) | ||
977 | /* sndbuf needs to have room for one request | ||
978 | * per thread, otherwise we can stall even when the | ||
979 | * network isn't a bottleneck. | ||
980 | * | ||
981 | * We count all threads rather than threads in a | ||
982 | * particular pool, which provides an upper bound | ||
983 | * on the number of threads which will access the socket. | ||
984 | * | ||
985 | * rcvbuf just needs to be able to hold a few requests. | ||
986 | * Normally they will be removed from the queue | ||
987 | * as soon a a complete request arrives. | ||
988 | */ | ||
989 | svc_sock_setbufsize(svsk->sk_sock, | ||
990 | (serv->sv_nrthreads+3) * serv->sv_max_mesg, | ||
991 | 3 * serv->sv_max_mesg); | ||
992 | |||
993 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 975 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
994 | 976 | ||
995 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { | 977 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { |
@@ -1367,15 +1349,6 @@ static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv) | |||
1367 | 1349 | ||
1368 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; | 1350 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; |
1369 | 1351 | ||
1370 | /* initialise setting must have enough space to | ||
1371 | * receive and respond to one request. | ||
1372 | * svc_tcp_recvfrom will re-adjust if necessary | ||
1373 | */ | ||
1374 | svc_sock_setbufsize(svsk->sk_sock, | ||
1375 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg, | ||
1376 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg); | ||
1377 | |||
1378 | set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); | ||
1379 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 1352 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
1380 | if (sk->sk_state != TCP_ESTABLISHED) | 1353 | if (sk->sk_state != TCP_ESTABLISHED) |
1381 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | 1354 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
@@ -1439,8 +1412,14 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
1439 | /* Initialize the socket */ | 1412 | /* Initialize the socket */ |
1440 | if (sock->type == SOCK_DGRAM) | 1413 | if (sock->type == SOCK_DGRAM) |
1441 | svc_udp_init(svsk, serv); | 1414 | svc_udp_init(svsk, serv); |
1442 | else | 1415 | else { |
1416 | /* initialise setting must have enough space to | ||
1417 | * receive and respond to one request. | ||
1418 | */ | ||
1419 | svc_sock_setbufsize(svsk->sk_sock, 4 * serv->sv_max_mesg, | ||
1420 | 4 * serv->sv_max_mesg); | ||
1443 | svc_tcp_init(svsk, serv); | 1421 | svc_tcp_init(svsk, serv); |
1422 | } | ||
1444 | 1423 | ||
1445 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", | 1424 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", |
1446 | svsk, svsk->sk_sk); | 1425 | svsk, svsk->sk_sk); |