From fefe89f4ca59a29b0ccf9ff57e8d77b0abbf3e60 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 16 Jul 2002 01:55:05 -0700 Subject: [PATCH] [PATCH] RPC over UDP congestion control updates [8/8] When determining who gets access to the socket, give priority to requests that are being resent. Despite the fact that congestion control now applies to resends, we still want to ensure that resends get ACKed as soon as possible (and before we start sending off new requests). --- include/linux/sunrpc/xprt.h | 1 + net/sunrpc/xprt.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index e123b110f719..0a247f460ff7 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -123,6 +123,7 @@ struct rpc_xprt { unsigned long cwnd; /* congestion window */ struct rpc_wait_queue sending; /* requests waiting to send */ + struct rpc_wait_queue resend; /* requests waiting to resend */ struct rpc_wait_queue pending; /* requests in flight */ struct rpc_wait_queue backlog; /* waiting for slot */ struct rpc_rqst * free; /* free slots */ diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 1c50e4fbf8a6..fc3bb3841329 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -150,7 +150,10 @@ xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) task->tk_pid, xprt->snd_task->tk_pid); task->tk_timeout = 0; task->tk_status = -EAGAIN; - rpc_sleep_on(&xprt->sending, task, NULL, NULL); + if (task->tk_rqstp->rq_nresend) + rpc_sleep_on(&xprt->resend, task, NULL, NULL); + else + rpc_sleep_on(&xprt->sending, task, NULL, NULL); } retval = xprt->snd_task == task; spin_unlock_bh(&xprt->sock_lock); @@ -166,9 +169,12 @@ __xprt_lock_write_next(struct rpc_xprt *xprt) return; if (!xprt->nocong && RPCXPRT_CONGESTED(xprt)) return; - task = rpc_wake_up_next(&xprt->sending); - if (!task) - return; + task = rpc_wake_up_next(&xprt->resend); + if (!task) { + task = rpc_wake_up_next(&xprt->sending); + if (!task) + return; + } if (xprt->nocong || __xprt_get_cong(xprt, task)) xprt->snd_task = task; } @@ -1346,6 +1352,7 @@ xprt_setup(struct socket *sock, int proto, INIT_RPC_WAITQ(&xprt->pending, "xprt_pending"); INIT_RPC_WAITQ(&xprt->sending, "xprt_sending"); + INIT_RPC_WAITQ(&xprt->resend, "xprt_resend"); INIT_RPC_WAITQ(&xprt->backlog, "xprt_backlog"); /* initialize free list */ @@ -1477,6 +1484,7 @@ xprt_shutdown(struct rpc_xprt *xprt) { xprt->shutdown = 1; rpc_wake_up(&xprt->sending); + rpc_wake_up(&xprt->resend); rpc_wake_up(&xprt->pending); rpc_wake_up(&xprt->backlog); if (waitqueue_active(&xprt->cong_wait)) -- 2.39.5