History

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.

David Howells committed 9 years ago

Commit f7aec121 parent 0430a266 files · +19 −6Browse files

Unified · Split

6 files
  1. net/rxrpc/ar-internal.h +2 −0
  2. net/rxrpc/call_accept.c +1 −0
  3. net/rxrpc/call_object.c +1 −6
  4. net/rxrpc/conn_client.c +6 −0
  5. net/rxrpc/conn_object.c +2 −0
  6. net/rxrpc/peer_object.c +7 −0
net/rxrpc/ar-internal.h+2−0
@@ -300,6 +300,8 @@ struct rxrpc_peer { · 299 unmodified lines
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+1−0
@@ -310,6 +310,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 309 unmodified lines
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+1−6
@@ -136,12 +136,7 @@ struct rxrpc_call *rxrpc_alloc_call(gfp_t gfp) · 135 unmodified lines
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+6−0
@@ -292,6 +292,12 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call, · 291 unmodified lines
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+2−0
@@ -193,6 +193,8 @@ void rxrpc_disconnect_call(struct rxrpc_call *call) · 192 unmodified lines
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+7−0
@@ -228,6 +228,13 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) · 227 unmodified lines
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);