rxrpc: Reduce unnecessary ack transmission
authorDavid Howells <dhowells@redhat.com>
Tue, 31 Jan 2023 21:40:18 +0000 (21:40 +0000)
committerDavid Howells <dhowells@redhat.com>
Tue, 7 Feb 2023 23:11:21 +0000 (23:11 +0000)
rxrpc_recvmsg_data() schedules an ACK to be transmitted every time at least
two packets have been consumed and any time it runs out of data and would
return -EAGAIN to the caller.  Both events may occur within a single loop,
however, and if the I/O thread is quick enough it may send duplicate ACKs.

The ACKs are sent to inform the peer that more space has been made in the
local Rx window, but the I/O thread is going to send an ACK every couple of
DATA packets anyway, so we end up sending a lot more ACKs than we really
need to.

So reduce the rate at which recvmsg() schedules ACKs, such that if the I/O
thread sends ACKs at its normal faster rate, recvmsg() won't actually
schedule ACKs until the Rx flow stops (call->rx_consumed is cleared any
time we transmit an ACK for that call, resetting the counter used by
recvmsg).

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org

net/rxrpc/recvmsg.c

index 50d263a6359d7995bd6dec8c8dc61a9e8ec0fa5d..76eb2b9cd936952f6a43e5c3f47e78caba5e30f3 100644 (file)
@@ -137,7 +137,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call)
        /* Check to see if there's an ACK that needs sending. */
        acked = atomic_add_return(call->rx_consumed - old_consumed,
                                  &call->ackr_nr_consumed);
-       if (acked > 2 &&
+       if (acked > 8 &&
            !test_and_set_bit(RXRPC_CALL_RX_IS_IDLE, &call->flags))
                rxrpc_poke_call(call, rxrpc_call_poke_idle);
 }