All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next 1/3] mptcp: optimize release_cb for the common case
@ 2022-03-18 11:06 Paolo Abeni
  2022-03-18 11:06 ` [PATCH mptcp-next 2/3] mptcp: reset the packet scheduler on incoming MP_PRIO Paolo Abeni
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Paolo Abeni @ 2022-03-18 11:06 UTC (permalink / raw)
  To: mptcp

The mptcp release callback checks several flags in atomic
context, but only MPTCP_CLEAN_UNA can be up frequently.

Reorganize the code to avoid multiple conditionals in the
most common scenarios.

Additional clarify a related comment.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index fbb14dfe62b3..bdba1ddee2a7 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3118,15 +3118,17 @@ static void mptcp_release_cb(struct sock *sk)
 		spin_lock_bh(&sk->sk_lock.slock);
 	}
 
-	/* be sure to set the current sk state before tacking actions
-	 * depending on sk_state
-	 */
-	if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags))
-		__mptcp_set_connected(sk);
 	if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags))
 		__mptcp_clean_una_wakeup(sk);
-	if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
-		__mptcp_error_report(sk);
+	if (unlikely(&msk->cb_flags)) {
+		/* be sure to set the current sk state before tacking actions
+		 * depending on sk_state, that is processing MPTCP_ERROR_REPORT
+		 */
+		if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags))
+			__mptcp_set_connected(sk);
+		if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
+			__mptcp_error_report(sk);
+	}
 
 	__mptcp_update_rmem(sk);
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-22 14:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-18 11:06 [PATCH mptcp-next 1/3] mptcp: optimize release_cb for the common case Paolo Abeni
2022-03-18 11:06 ` [PATCH mptcp-next 2/3] mptcp: reset the packet scheduler on incoming MP_PRIO Paolo Abeni
2022-03-22  0:21   ` Mat Martineau
2022-03-22 14:46     ` Paolo Abeni
2022-03-18 11:06 ` [PATCH mptcp-next 3/3] mptcp: reset the packet scheduler on PRIO change Paolo Abeni
2022-03-22  0:22   ` Mat Martineau
2022-03-22  0:22 ` [PATCH mptcp-next 1/3] mptcp: optimize release_cb for the common case Mat Martineau

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.