Skip to contentSkip to conversation

net/smc: add sysctl for smc_limit_hs

PATCH Superseded D. Wythe 2 participants 3 messages Aug 15, 2024 – Aug 16, 2024

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

D. Wythe

author maintainer
#0 lore raw

PATCH 1/1 net/smc: add sysctl for smc_limit_hs

From: "D. Wythe" <[email protected]>

In commit 48b6190a0042 ("net/smc: Limit SMC visits when handshake workqueue congested"), we introduce a mechanism to put constraint on SMC connections visit according to the pressure of SMC handshake process.

At that time, we believed that controlling the feature through netlink was sufficient, However, most people have realized now that netlink is not convenient in container scenarios, and sysctl is a more suitable approach.

In addition, it is not reasonable for us to initialize limit_smc_hs in smc_pnet_net_init, we made a mistable before. It should be initialized in smc_sysctl_net_init(), just like other systcl.

---
 net/smc/smc_pnet.c   |  3 ---
 net/smc/smc_sysctl.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
net/smc/smc_pnet.c +0 -3
index 2adb92b..1dd3623 100644
@@ -887,9 +887,6 @@ int smc_pnet_net_init(struct net *net)
 
 	smc_pnet_create_pnetids_list(net);
 
-	/* disable handshake limitation by default */
-	net->smc.limit_smc_hs = 0;
-
 	return 0;
 }
 
net/smc/smc_sysctl.c +11 -0
index 13f2bc0..2fab645 100644
@@ -90,6 +90,15 @@
 		.extra1		= &conns_per_lgr_min,
 		.extra2		= &conns_per_lgr_max,
 	},
+	{
+		.procname	= "limit_smc_hs",
+		.data		= &init_net.smc.limit_smc_hs,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
 };
 
 int __net_init smc_sysctl_net_init(struct net *net)
@@ -121,6 +130,8 @@ int __net_init smc_sysctl_net_init(struct net *net)
 	WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init);
 	net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
 	net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
+	/* disable handshake limitation by default */
+	net->smc.limit_smc_hs = 0;
 
 	return 0;
 
Signature · 1 line
1.8.3.1
reviewer
#1 lore raw
Quoted 6 lines · D. Wythe

From: "D. Wythe" <[email protected]>

In commit 48b6190a0042 ("net/smc: Limit SMC visits when handshake workqueue congested"), we introduce a mechanism to put constraint on SMC connections visit according to the pressure of SMC handshake process.

Quoted 6 lines

At that time, we believed that controlling the feature through netlink was sufficient, However, most people have realized now that netlink is not convenient in container scenarios, and sysctl is a more suitable approach.

In addition, it is not reasonable for us to initialize limit_smc_hs in smc_pnet_net_init, we made a mistable before. It should be initialized

nit: mistable -> mistake?

Quoted 51 lines

in smc_sysctl_net_init(), just like other systcl.

---
  net/smc/smc_pnet.c   |  3 ---
  net/smc/smc_sysctl.c | 11 +++++++++++
  2 files changed, 11 insertions(+), 3 deletions(-)
net/smc/smc_pnet.c +0 -3
index 2adb92b..1dd3623 100644
@@ -887,9 +887,6 @@ int smc_pnet_net_init(struct net *net)
 
  	smc_pnet_create_pnetids_list(net);
 
-	/* disable handshake limitation by default */
-	net->smc.limit_smc_hs = 0;
-
  	return 0;
  }
 
net/smc/smc_sysctl.c +11 -0
index 13f2bc0..2fab645 100644
@@ -90,6 +90,15 @@
  		.extra1		= &conns_per_lgr_min,
  		.extra2		= &conns_per_lgr_max,
  	},
+	{
+		.procname	= "limit_smc_hs",
+		.data		= &init_net.smc.limit_smc_hs,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
  };
 
  int __net_init smc_sysctl_net_init(struct net *net)
@@ -121,6 +130,8 @@ int __net_init smc_sysctl_net_init(struct net *net)
  	WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init);
  	net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
  	net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
+	/* disable handshake limitation by default */
+	net->smc.limit_smc_hs = 0;
 
  	return 0;
 
author maintainer
#2 lore raw
Quoted 9 lines · Wen Gu
Quoted 6 lines · D. Wythe

From: "D. Wythe" <[email protected]>

In commit 48b6190a0042 ("net/smc: Limit SMC visits when handshake workqueue congested"), we introduce a mechanism to put constraint on SMC connections visit according to the pressure of SMC handshake process.

Quoted 8 lines
Quoted 6 lines

At that time, we believed that controlling the feature through netlink was sufficient, However, most people have realized now that netlink is not convenient in container scenarios, and sysctl is a more suitable approach.

In addition, it is not reasonable for us to initialize limit_smc_hs in smc_pnet_net_init, we made a mistable before. It should be initialized

nit: mistable -> mistake?

Take it. Also, I suddenly realized that the reason for initializing limit_smc_hs in smc_pnet_net_init before was because there was no smc_sysctl_net_init at that time ...

D. Wythe

Quoted 46 lines
Quoted 46 lines

in smc_sysctl_net_init(), just like other systcl.

---
  net/smc/smc_pnet.c   |  3 ---
  net/smc/smc_sysctl.c | 11 +++++++++++

  2 files changed, 11 insertions(+), 3 deletions(-)
net/smc/smc_pnet.c +0 -0
index 2adb92b..1dd3623 100644
@@ -887,9 +887,6 @@ int smc_pnet_net_init(struct net *net)
         smc_pnet_create_pnetids_list(net);

  -    /* disable handshake limitation by default */ -    net->smc.limit_smc_hs = 0;
-
      return 0;
  }
  diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c index 13f2bc0..2fab645 100644

net/smc/smc_sysctl.c +11 -0
@@ -90,6 +90,15 @@
           .extra1        = &conns_per_lgr_min,
           .extra2        = &conns_per_lgr_max,
       },
+    {
+        .procname    = "limit_smc_hs",
+        .data        = &init_net.smc.limit_smc_hs,
+        .maxlen        = sizeof(int),
+        .mode        = 0644,
+        .proc_handler    = proc_dointvec_minmax,
+        .extra1        = SYSCTL_ZERO,
+        .extra2        = SYSCTL_ONE,
+    },
   };
     int __net_init smc_sysctl_net_init(struct net *net)
@@ -121,6 +130,8 @@ int __net_init smc_sysctl_net_init(struct net *net)
       WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init);
       net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
       net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
+    /* disable handshake limitation by default */
+    net->smc.limit_smc_hs = 0;
         return 0;