Skip to contentSkip to conversation

net/smc: Optimize the timing of unlocking in smc_listen_work

PATCH In review liqiang 2 participants 3 messages Nov 30, 2024 – Dec 2, 2024

Subsystems (4)
lore
Share & tools
lore

liqiang

author
#0 lore raw

PATCH 1/1 net/smc: Optimize the timing of unlocking in smc_listen_work

The optimized code is equivalent to the original process, and it releases the lock early.

---
 net/smc/af_smc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -2
index 9d76e902fd77..7fa80be1ea93 100644
@@ -2526,9 +2526,9 @@ static void smc_listen_work(struct work_struct *work)
 	if (!ini->is_smcd) {
 		rc = smc_listen_rdma_finish(new_smc, cclc,
 					    ini->first_contact_local, ini);
-		if (rc)
-			goto out_unlock;
 		mutex_unlock(&smc_server_lgr_pending);
+		if (rc)
+			goto out_decl;
 	}
 	smc_conn_save_peer_info(new_smc, cclc);
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 2 lines · On Sat, 30 Nov 2024 16:26:30 +0800 liqiang wrote:

The optimized code is equivalent to the original process, and it releases the lock early.

By a single clock cycle? You need to provide much more detailed justification, otherwise this looks like churn for no real gain.

Signature · 1 line
pw-bot: cr
author
#2 lore raw
Quoted 6 lines · Jakub Kicinski
Quoted 2 lines · On Sat, 30 Nov 2024 16:26:30 +0800 liqiang wrote:

The optimized code is equivalent to the original process, and it releases the lock early.

By a single clock cycle? You need to provide much more detailed justification, otherwise this looks like churn for no real gain.

I don't have any more information about this patch, I saw that the lock will be released regardless of branch true or false, so brought it forward.

Thanks for your reply, Jakub!
:)

Signature · 2 lines
Cheers,
Li Qiang