Skip to content

Commit f7aec12

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Cache the congestion window setting
Cache the congestion window setting that was determined during a call's transmission phase when it finishes so that it can be used by the next call to the same peer, thereby shortcutting the slow-start algorithm. The value is stored in the rxrpc_peer struct and is accessed without locking. Each call takes the value that happens to be there when it starts and just overwrites the value when it finishes. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0430a26 commit f7aec12

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

net/rxrpc/ar-internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ struct rxrpc_peer {
300300
u64 rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* Determined RTT cache */
301301
u8 rtt_cursor; /* next entry at which to insert */
302302
u8 rtt_usage; /* amount of cache actually used */
303+
304+
u8 cong_cwnd; /* Congestion window size */
303305
};
304306

305307
/*

net/rxrpc/call_accept.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
310310
rxrpc_see_call(call);
311311
call->conn = conn;
312312
call->peer = rxrpc_get_peer(conn->params.peer);
313+
call->cong_cwnd = call->peer->cong_cwnd;
313314
return call;
314315
}
315316

net/rxrpc/call_object.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,7 @@ struct rxrpc_call *rxrpc_alloc_call(gfp_t gfp)
136136
call->tx_winsize = 16;
137137
call->rx_expect_next = 1;
138138

139-
if (RXRPC_TX_SMSS > 2190)
140-
call->cong_cwnd = 2;
141-
else if (RXRPC_TX_SMSS > 1095)
142-
call->cong_cwnd = 3;
143-
else
144-
call->cong_cwnd = 4;
139+
call->cong_cwnd = 2;
145140
call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1;
146141
return call;
147142

net/rxrpc/conn_client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
292292
if (!cp->peer)
293293
goto error;
294294

295+
call->cong_cwnd = cp->peer->cong_cwnd;
296+
if (call->cong_cwnd >= call->cong_ssthresh)
297+
call->cong_mode = RXRPC_CALL_CONGEST_AVOIDANCE;
298+
else
299+
call->cong_mode = RXRPC_CALL_SLOW_START;
300+
295301
/* If the connection is not meant to be exclusive, search the available
296302
* connections to see if the connection we want to use already exists.
297303
*/

net/rxrpc/conn_object.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ void rxrpc_disconnect_call(struct rxrpc_call *call)
193193
{
194194
struct rxrpc_connection *conn = call->conn;
195195

196+
call->peer->cong_cwnd = call->cong_cwnd;
197+
196198
spin_lock_bh(&conn->params.peer->lock);
197199
hlist_del_init(&call->error_link);
198200
spin_unlock_bh(&conn->params.peer->lock);

net/rxrpc/peer_object.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp)
228228
seqlock_init(&peer->service_conn_lock);
229229
spin_lock_init(&peer->lock);
230230
peer->debug_id = atomic_inc_return(&rxrpc_debug_id);
231+
232+
if (RXRPC_TX_SMSS > 2190)
233+
peer->cong_cwnd = 2;
234+
else if (RXRPC_TX_SMSS > 1095)
235+
peer->cong_cwnd = 3;
236+
else
237+
peer->cong_cwnd = 4;
231238
}
232239

233240
_leave(" = %p", peer);

0 commit comments

Comments
 (0)