Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rxrpc: Don't need barrier for ->tx_bottom and ->acks_hard_ack

We don't need a barrier for the ->tx_bottom value (which indicates the
lowest sequence still in the transmission queue) and the ->acks_hard_ack
value (which tracks the DATA packets hard-ack'd by the latest ACK packet
received and thus indicates which DATA packets can now be discarded) as the
app thread doesn't use either value as a reference to memory to access.
Rather, the app thread merely uses these as a guide to how much space is
available in the transmission queue

Change the code to use READ/WRITE_ONCE() instead.

Also, change rxrpc_check_tx_space() to use the same value for tx_bottom
throughout.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20241204074710.990092-18-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Howells and committed by
Jakub Kicinski
6396b48a 976b0ca5

+7 -5
+5 -3
net/rxrpc/sendmsg.c
··· 94 94 */ 95 95 static bool rxrpc_check_tx_space(struct rxrpc_call *call, rxrpc_seq_t *_tx_win) 96 96 { 97 + rxrpc_seq_t tx_bottom = READ_ONCE(call->tx_bottom); 98 + 97 99 if (_tx_win) 98 - *_tx_win = call->tx_bottom; 99 - return call->tx_prepared - call->tx_bottom < 256; 100 + *_tx_win = tx_bottom; 101 + return call->tx_prepared - tx_bottom < 256; 100 102 } 101 103 102 104 /* ··· 140 138 rtt = 2; 141 139 142 140 timeout = rtt; 143 - tx_start = smp_load_acquire(&call->acks_hard_ack); 141 + tx_start = READ_ONCE(call->acks_hard_ack); 144 142 145 143 for (;;) { 146 144 set_current_state(TASK_UNINTERRUPTIBLE);
+2 -2
net/rxrpc/txbuf.c
··· 214 214 215 215 while ((txb = list_first_entry_or_null(&call->tx_buffer, 216 216 struct rxrpc_txbuf, call_link))) { 217 - hard_ack = smp_load_acquire(&call->acks_hard_ack); 217 + hard_ack = call->acks_hard_ack; 218 218 if (before(hard_ack, txb->seq)) 219 219 break; 220 220 221 221 if (txb->seq != call->tx_bottom + 1) 222 222 rxrpc_see_txbuf(txb, rxrpc_txbuf_see_out_of_step); 223 223 ASSERTCMP(txb->seq, ==, call->tx_bottom + 1); 224 - smp_store_release(&call->tx_bottom, call->tx_bottom + 1); 224 + WRITE_ONCE(call->tx_bottom, call->tx_bottom + 1); 225 225 list_del_rcu(&txb->call_link); 226 226 227 227 trace_rxrpc_txqueue(call, rxrpc_txqueue_dequeue);