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

net/smc: add sysctl for smc_limit_hs

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, since commit 462791bbfa35 ("net/smc: add sysctl interface for SMC")
had introcuded smc_sysctl_net_init(), it is reasonable for us to
initialize limit_smc_hs in it instead of initializing it in
smc_pnet_net_int().

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Link: https://patch.msgid.link/1725590135-5631-1-git-send-email-alibuda@linux.alibaba.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

D. Wythe and committed by
Paolo Abeni
f8406a2f 0246388b

+11 -3
-3
net/smc/smc_pnet.c
··· 887 887 888 888 smc_pnet_create_pnetids_list(net); 889 889 890 - /* disable handshake limitation by default */ 891 - net->smc.limit_smc_hs = 0; 892 - 893 890 return 0; 894 891 } 895 892
+11
net/smc/smc_sysctl.c
··· 90 90 .extra1 = &conns_per_lgr_min, 91 91 .extra2 = &conns_per_lgr_max, 92 92 }, 93 + { 94 + .procname = "limit_smc_hs", 95 + .data = &init_net.smc.limit_smc_hs, 96 + .maxlen = sizeof(int), 97 + .mode = 0644, 98 + .proc_handler = proc_dointvec_minmax, 99 + .extra1 = SYSCTL_ZERO, 100 + .extra2 = SYSCTL_ONE, 101 + }, 93 102 }; 94 103 95 104 int __net_init smc_sysctl_net_init(struct net *net) ··· 130 121 WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init); 131 122 net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER; 132 123 net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER; 124 + /* disable handshake limitation by default */ 125 + net->smc.limit_smc_hs = 0; 133 126 134 127 return 0; 135 128