rxrpc: Remove atomic handling on some fields only used in I/O thread
authorDavid Howells <dhowells@redhat.com>
Mon, 29 Jan 2024 22:29:58 +0000 (22:29 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 29 Feb 2024 15:49:58 +0000 (15:49 +0000)
call->tx_transmitted and call->acks_prev_seq don't need to be managed with
cmpxchg() and barriers as it's only used within the singular I/O thread.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org

net/rxrpc/call_event.c
net/rxrpc/output.c

index 84eedbb49fcb85e6f7b495ce1ae12cadc7257ef6..1184518dcdb8bdbf4ea83ecceaa75d5451df8e68 100644 (file)
@@ -115,7 +115,7 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
        struct rxrpc_skb_priv *sp;
        struct rxrpc_txbuf *txb;
        unsigned long resend_at;
-       rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted);
+       rxrpc_seq_t transmitted = call->tx_transmitted;
        ktime_t now, max_age, oldest, ack_ts;
        bool unacked = false;
        unsigned int i;
@@ -184,16 +184,14 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
         * seen.  Anything between the soft-ACK table and that point will get
         * ACK'd or NACK'd in due course, so don't worry about it here; here we
         * need to consider retransmitting anything beyond that point.
-        *
-        * Note that ACK for a packet can beat the update of tx_transmitted.
         */
-       if (after_eq(READ_ONCE(call->acks_prev_seq), READ_ONCE(call->tx_transmitted)))
+       if (after_eq(call->acks_prev_seq, call->tx_transmitted))
                goto no_further_resend;
 
        list_for_each_entry_from(txb, &call->tx_buffer, call_link) {
-               if (before_eq(txb->seq, READ_ONCE(call->acks_prev_seq)))
+               if (before_eq(txb->seq, call->acks_prev_seq))
                        continue;
-               if (after(txb->seq, READ_ONCE(call->tx_transmitted)))
+               if (after(txb->seq, call->tx_transmitted))
                        break; /* Not transmitted yet */
 
                if (ack && ack->reason == RXRPC_ACK_PING_RESPONSE &&
index 2386b01b2231aec7bf506f95d36a061966674b8b..1e039b6f4494a540b8b5a3234738d127640327f6 100644 (file)
@@ -397,12 +397,10 @@ dont_set_request_ack:
 
        /* Track what we've attempted to transmit at least once so that the
         * retransmission algorithm doesn't try to resend what we haven't sent
-        * yet.  However, this can race as we can receive an ACK before we get
-        * to this point.  But, OTOH, if we won't get an ACK mentioning this
-        * packet unless the far side received it (though it could have
-        * discarded it anyway and NAK'd it).
+        * yet.
         */
-       cmpxchg(&call->tx_transmitted, txb->seq - 1, txb->seq);
+       if (txb->seq == call->tx_transmitted + 1)
+               call->tx_transmitted = txb->seq;
 
        /* send the packet with the don't fragment bit set if we currently
         * think it's small enough */