From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v2 05/21] rxrpc: Strip barriers and atomics off of timer tracking
Date: Mon, 4 Mar 2024 08:43:02 +0000 [thread overview]
Message-ID: <20240304084322.705539-6-dhowells@redhat.com> (raw)
In-Reply-To: <20240304084322.705539-1-dhowells@redhat.com>
Strip the atomic ops and barriering off of the call timer tracking as this
is handled solely within the I/O thread, except for expect_term_by which is
set by sendmsg().
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 | 32 ++++++++++++++++----------------
net/rxrpc/conn_client.c | 4 ++--
net/rxrpc/input.c | 15 ++++++---------
net/rxrpc/output.c | 18 ++++++++----------
4 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 77eacbfc5d45..84eedbb49fcb 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -27,7 +27,7 @@ void rxrpc_propose_ping(struct rxrpc_call *call, u32 serial,
unsigned long ping_at = now + rxrpc_idle_ack_delay;
if (time_before(ping_at, call->ping_at)) {
- WRITE_ONCE(call->ping_at, ping_at);
+ call->ping_at = ping_at;
rxrpc_reduce_call_timer(call, ping_at, now,
rxrpc_timer_set_for_ping);
trace_rxrpc_propose_ack(call, why, RXRPC_ACK_PING, serial);
@@ -53,7 +53,7 @@ void rxrpc_propose_delay_ACK(struct rxrpc_call *call, rxrpc_serial_t serial,
ack_at += READ_ONCE(call->tx_backoff);
ack_at += now;
if (time_before(ack_at, call->delay_ack_at)) {
- WRITE_ONCE(call->delay_ack_at, ack_at);
+ call->delay_ack_at = ack_at;
rxrpc_reduce_call_timer(call, ack_at, now,
rxrpc_timer_set_for_ack);
}
@@ -220,7 +220,7 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest)));
resend_at += jiffies + rxrpc_get_rto_backoff(call->peer,
!list_empty(&retrans_queue));
- WRITE_ONCE(call->resend_at, resend_at);
+ call->resend_at = resend_at;
if (unacked)
rxrpc_congestion_timeout(call);
@@ -260,7 +260,7 @@ static void rxrpc_begin_service_reply(struct rxrpc_call *call)
unsigned long now = jiffies;
rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SEND_REPLY);
- WRITE_ONCE(call->delay_ack_at, now + MAX_JIFFY_OFFSET);
+ call->delay_ack_at = now + MAX_JIFFY_OFFSET;
if (call->ackr_reason == RXRPC_ACK_DELAY)
call->ackr_reason = 0;
trace_rxrpc_timer(call, rxrpc_timer_init_for_send_reply, now);
@@ -399,13 +399,13 @@ bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb)
/* If we see our async-event poke, check for timeout trippage. */
now = jiffies;
- t = READ_ONCE(call->expect_rx_by);
+ t = call->expect_rx_by;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_normal, now);
expired = true;
}
- t = READ_ONCE(call->expect_req_by);
+ t = call->expect_req_by;
if (__rxrpc_call_state(call) == RXRPC_CALL_SERVER_RECV_REQUEST &&
time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_idle, now);
@@ -418,41 +418,41 @@ bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb)
expired = true;
}
- t = READ_ONCE(call->delay_ack_at);
+ t = call->delay_ack_at;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_ack, now);
- cmpxchg(&call->delay_ack_at, t, now + MAX_JIFFY_OFFSET);
+ call->delay_ack_at = now + MAX_JIFFY_OFFSET;
rxrpc_send_ACK(call, RXRPC_ACK_DELAY, 0,
rxrpc_propose_ack_ping_for_lost_ack);
}
- t = READ_ONCE(call->ack_lost_at);
+ t = call->ack_lost_at;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_lost_ack, now);
- cmpxchg(&call->ack_lost_at, t, now + MAX_JIFFY_OFFSET);
+ call->ack_lost_at = now + MAX_JIFFY_OFFSET;
set_bit(RXRPC_CALL_EV_ACK_LOST, &call->events);
}
- t = READ_ONCE(call->keepalive_at);
+ t = call->keepalive_at;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_keepalive, now);
- cmpxchg(&call->keepalive_at, t, now + MAX_JIFFY_OFFSET);
+ call->keepalive_at = now + MAX_JIFFY_OFFSET;
rxrpc_send_ACK(call, RXRPC_ACK_PING, 0,
rxrpc_propose_ack_ping_for_keepalive);
}
- t = READ_ONCE(call->ping_at);
+ t = call->ping_at;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_ping, now);
- cmpxchg(&call->ping_at, t, now + MAX_JIFFY_OFFSET);
+ call->ping_at = now + MAX_JIFFY_OFFSET;
rxrpc_send_ACK(call, RXRPC_ACK_PING, 0,
rxrpc_propose_ack_ping_for_keepalive);
}
- t = READ_ONCE(call->resend_at);
+ t = call->resend_at;
if (time_after_eq(now, t)) {
trace_rxrpc_timer(call, rxrpc_timer_exp_resend, now);
- cmpxchg(&call->resend_at, t, now + MAX_JIFFY_OFFSET);
+ call->resend_at = now + MAX_JIFFY_OFFSET;
resend = true;
}
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 3b9b267a4431..d25bf1cf3670 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -636,7 +636,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_bundle *bundle, struct rxrpc_call
test_bit(RXRPC_CALL_EXPOSED, &call->flags)) {
unsigned long final_ack_at = jiffies + 2;
- WRITE_ONCE(chan->final_ack_at, final_ack_at);
+ chan->final_ack_at = final_ack_at;
smp_wmb(); /* vs rxrpc_process_delayed_final_acks() */
set_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags);
rxrpc_reduce_conn_timer(conn, final_ack_at);
@@ -770,7 +770,7 @@ void rxrpc_discard_expired_client_conns(struct rxrpc_local *local)
conn_expires_at = conn->idle_timestamp + expiry;
- now = READ_ONCE(jiffies);
+ now = jiffies;
if (time_after(conn_expires_at, now))
goto not_yet_expired;
}
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index ea2df62e05e7..e53a49accc16 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -288,14 +288,12 @@ static void rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun,
static bool rxrpc_receiving_reply(struct rxrpc_call *call)
{
struct rxrpc_ack_summary summary = { 0 };
- unsigned long now, timo;
+ unsigned long now;
rxrpc_seq_t top = READ_ONCE(call->tx_top);
if (call->ackr_reason) {
now = jiffies;
- timo = now + MAX_JIFFY_OFFSET;
-
- WRITE_ONCE(call->delay_ack_at, timo);
+ call->delay_ack_at = now + MAX_JIFFY_OFFSET;
trace_rxrpc_timer(call, rxrpc_timer_init_for_reply, now);
}
@@ -594,7 +592,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)
if (timo) {
now = jiffies;
expect_req_by = now + timo;
- WRITE_ONCE(call->expect_req_by, expect_req_by);
+ call->expect_req_by = now + timo;
rxrpc_reduce_call_timer(call, expect_req_by, now,
rxrpc_timer_set_for_idle);
}
@@ -1048,11 +1046,10 @@ void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)
timo = READ_ONCE(call->next_rx_timo);
if (timo) {
- unsigned long now = jiffies, expect_rx_by;
+ unsigned long now = jiffies;
- expect_rx_by = now + timo;
- WRITE_ONCE(call->expect_rx_by, expect_rx_by);
- rxrpc_reduce_call_timer(call, expect_rx_by, now,
+ call->expect_rx_by = now + timo;
+ rxrpc_reduce_call_timer(call, call->expect_rx_by, now,
rxrpc_timer_set_for_normal);
}
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 3803bf900a46..2386b01b2231 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -67,11 +67,10 @@ static void rxrpc_tx_backoff(struct rxrpc_call *call, int ret)
*/
static void rxrpc_set_keepalive(struct rxrpc_call *call)
{
- unsigned long now = jiffies, keepalive_at = call->next_rx_timo / 6;
+ unsigned long now = jiffies;
- keepalive_at += now;
- WRITE_ONCE(call->keepalive_at, keepalive_at);
- rxrpc_reduce_call_timer(call, keepalive_at, now,
+ call->keepalive_at = now + call->next_rx_timo / 6;
+ rxrpc_reduce_call_timer(call, call->keepalive_at, now,
rxrpc_timer_set_for_keepalive);
}
@@ -449,7 +448,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
ack_lost_at = rxrpc_get_rto_backoff(call->peer, false);
ack_lost_at += nowj;
- WRITE_ONCE(call->ack_lost_at, ack_lost_at);
+ call->ack_lost_at = ack_lost_at;
rxrpc_reduce_call_timer(call, ack_lost_at, nowj,
rxrpc_timer_set_for_lost_ack);
}
@@ -458,11 +457,10 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
if (txb->seq == 1 &&
!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER,
&call->flags)) {
- unsigned long nowj = jiffies, expect_rx_by;
+ unsigned long nowj = jiffies;
- expect_rx_by = nowj + call->next_rx_timo;
- WRITE_ONCE(call->expect_rx_by, expect_rx_by);
- rxrpc_reduce_call_timer(call, expect_rx_by, nowj,
+ call->expect_rx_by = nowj + call->next_rx_timo;
+ rxrpc_reduce_call_timer(call, call->expect_rx_by, nowj,
rxrpc_timer_set_for_normal);
}
@@ -724,7 +722,7 @@ void rxrpc_transmit_one(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
unsigned long now = jiffies;
unsigned long resend_at = now + call->peer->rto_j;
- WRITE_ONCE(call->resend_at, resend_at);
+ call->resend_at = resend_at;
rxrpc_reduce_call_timer(call, resend_at, now,
rxrpc_timer_set_for_send);
}
next prev parent reply other threads:[~2024-03-04 8:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 8:42 [PATCH net-next v2 00/21] rxrpc: Miscellaneous changes and make use of MSG_SPLICE_PAGES David Howells
2024-03-04 8:42 ` [PATCH net-next v2 01/21] rxrpc: Record the Tx serial in the rxrpc_txbuf and retransmit trace David Howells
2024-03-04 8:42 ` [PATCH net-next v2 02/21] rxrpc: Convert rxrpc_txbuf::flags into a mask and don't use atomics David Howells
2024-03-04 8:43 ` [PATCH net-next v2 03/21] rxrpc: Note cksum in txbuf David Howells
2024-03-04 8:43 ` [PATCH net-next v2 04/21] rxrpc: Fix the names of the fields in the ACK trailer struct David Howells
2024-03-04 8:43 ` David Howells [this message]
2024-03-04 8:43 ` [PATCH net-next v2 06/21] rxrpc: Remove atomic handling on some fields only used in I/O thread David Howells
2024-03-04 8:43 ` [PATCH net-next v2 07/21] rxrpc: Do lazy DF flag resetting David Howells
2024-03-04 8:43 ` [PATCH net-next v2 08/21] rxrpc: Merge together DF/non-DF branches of data Tx function David Howells
2024-03-04 8:43 ` [PATCH net-next v2 09/21] rxrpc: Add a kvec[] to the rxrpc_txbuf struct David Howells
2024-03-04 8:43 ` [PATCH net-next v2 10/21] rxrpc: Split up the DATA packet transmission function David Howells
2024-03-04 8:43 ` [PATCH net-next v2 11/21] rxrpc: Don't pick values out of the wire header when setting up security David Howells
2024-03-04 8:43 ` [PATCH net-next v2 12/21] rxrpc: Move rxrpc_send_ACK() to output.c with rxrpc_send_ack_packet() David Howells
2024-03-04 8:43 ` [PATCH net-next v2 13/21] rxrpc: Use rxrpc_txbuf::kvec[0] instead of rxrpc_txbuf::wire David Howells
2024-03-04 8:43 ` [PATCH net-next v2 14/21] rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags David Howells
2024-03-05 14:03 ` Simon Horman
2024-03-04 8:43 ` [PATCH net-next v2 15/21] rxrpc: Parse received packets before dealing with timeouts David Howells
2024-03-04 8:43 ` [PATCH net-next v2 16/21] rxrpc: Don't permit resending after all Tx packets acked David Howells
2024-03-04 8:43 ` [PATCH net-next v2 17/21] rxrpc: Differentiate PING ACK transmission traces David Howells
2024-03-04 8:43 ` [PATCH net-next v2 18/21] rxrpc: Use ktimes for call timeout tracking and set the timer lazily David Howells
2024-03-04 8:43 ` [PATCH net-next v2 19/21] rxrpc: Record probes after transmission and reduce number of time-gets David Howells
2024-03-04 8:43 ` [PATCH net-next v2 20/21] rxrpc: Clean up the resend algorithm David Howells
2024-03-04 8:43 ` [PATCH net-next v2 21/21] rxrpc: Extract useful fields from a received ACK to skb priv data David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240304084322.705539-6-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.