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

net/smc: add sysctl for autocorking

This add a new sysctl: net.smc.autocorking_size

We can dynamically change the behaviour of autocorking
by change the value of autocorking_size.
Setting to 0 disables autocorking in SMC

Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Dust Li and committed by
David S. Miller
12bbb0d1 dcd2cf5f

+35 -1
+23
Documentation/networking/smc-sysctl.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ========= 4 + SMC Sysctl 5 + ========= 6 + 7 + /proc/sys/net/smc/* Variables 8 + ============================== 9 + 10 + autocorking_size - INTEGER 11 + Setting SMC auto corking size: 12 + SMC auto corking is like TCP auto corking from the application's 13 + perspective of view. When applications do consecutive small 14 + write()/sendmsg() system calls, we try to coalesce these small writes 15 + as much as possible, to lower total amount of CDC and RDMA Write been 16 + sent. 17 + autocorking_size limits the maximum corked bytes that can be sent to 18 + the under device in 1 single sending. If set to 0, the SMC auto corking 19 + is disabled. 20 + Applications can still use TCP_CORK for optimal behavior when they 21 + know how/when to uncork their sockets. 22 + 23 + Default: 64K
+1
include/net/netns/smc.h
··· 17 17 #ifdef CONFIG_SYSCTL 18 18 struct ctl_table_header *smc_hdr; 19 19 #endif 20 + unsigned int sysctl_autocorking_size; 20 21 }; 21 22 #endif
+10
net/smc/smc_sysctl.c
··· 14 14 #include <linux/sysctl.h> 15 15 #include <net/net_namespace.h> 16 16 17 + #include "smc.h" 17 18 #include "smc_sysctl.h" 18 19 19 20 static struct ctl_table smc_table[] = { 21 + { 22 + .procname = "autocorking_size", 23 + .data = &init_net.smc.sysctl_autocorking_size, 24 + .maxlen = sizeof(unsigned int), 25 + .mode = 0644, 26 + .proc_handler = proc_douintvec, 27 + }, 20 28 { } 21 29 }; 22 30 ··· 47 39 net->smc.smc_hdr = register_net_sysctl(net, "net/smc", table); 48 40 if (!net->smc.smc_hdr) 49 41 goto err_reg; 42 + 43 + net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; 50 44 51 45 return 0; 52 46
+1 -1
net/smc/smc_tx.c
··· 147 147 struct smc_connection *conn = &smc->conn; 148 148 int corking_size; 149 149 150 - corking_size = min(SMC_AUTOCORKING_DEFAULT_SIZE, 150 + corking_size = min(sock_net(&smc->sk)->smc.sysctl_autocorking_size, 151 151 conn->sndbuf_desc->len >> 1); 152 152 153 153 if (atomic_read(&conn->cdc_pend_tx_wr) == 0 ||