]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: Clear memory when release and reuse buffer
authorTony Lu <tonylu@linux.alibaba.com>
Fri, 3 Dec 2021 11:33:31 +0000 (12:33 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Dec 2021 01:01:28 +0000 (17:01 -0800)
commit0baf3dfda3a8684ea31776da89ab9c35024a33b7
treeb103539ecf652fefde85bc00383092a18bdea351
parent1cef9f8dec29fa8d42a94b4c257c775dfd1d8a2a
net/smc: Clear memory when release and reuse buffer

Currently, buffers are cleared when smc connections are created and
buffers are reused. This slows down the speed of establishing new
connections. In most cases, the applications want to establish
connections as quickly as possible.

This patch moves memset() from connection creation path to release and
buffer unuse path, this trades off between speed of establishing and
release.

Test environments:
- CPU Intel Xeon Platinum 8 core, mem 32 GiB, nic Mellanox CX4
- socket sndbuf / rcvbuf: 16384 / 131072 bytes
- w/o first round, 5 rounds, avg, 100 conns batch per round
- smc_buf_create() use bpftrace kprobe, introduces extra latency

Latency benchmarks for smc_buf_create():
  w/o patch : 19040.0 ns
  w/  patch :  1932.6 ns
  ratio :        10.2% (-89.8%)

Latency benchmarks for socket create and connect:
  w/o patch :   143.3 us
  w/  patch :   102.2 us
  ratio :        71.3% (-28.7%)

The latency of establishing connections is reduced by 28.7%.

Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20211203113331.2818873-1-kgraul@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/smc/smc_core.c