Skip to contentSkip to conversation

net: rds: use memset to optimize the recv

PATCH Superseded Zhu Yanjun 4 participants 4 messages Sep 14, 2018 – Sep 17, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zhu Yanjun

author
#0 lore raw

PATCH 1/1 net: rds: use memset to optimize the recv

The function rds_inc_init is in recv process. To use memset can optimize the function rds_inc_init.
The test result:

Before:
1) + 24.950 us | rds_inc_init [rds]();
After:
1) + 10.990 us | rds_inc_init [rds]();

---
 net/rds/recv.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/rds/recv.c +1 -4
index 504cd6bcc54c..a9399ddbb7bf 100644
@@ -43,8 +43,6 @@
 void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
 		 struct in6_addr *saddr)
 {
-	int i;
-
 	refcount_set(&inc->i_refcount, 1);
 	INIT_LIST_HEAD(&inc->i_item);
 	inc->i_conn = conn;
@@ -53,8 +51,7 @@ void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
 	inc->i_rx_tstamp.tv_sec = 0;
 	inc->i_rx_tstamp.tv_usec = 0;
 
-	for (i = 0; i < RDS_RX_MAX_TRACES; i++)
-		inc->i_rx_lat_trace[i] = 0;
+	memset(inc->i_rx_lat_trace, 0, sizeof(inc->i_rx_lat_trace));
 }
 EXPORT_SYMBOL_GPL(rds_inc_init);
 
Signature · 1 line
2.17.1
maintainer
#2 lore raw
In reply to Zhu Yanjun

From: Zhu Yanjun <[email protected]>
Date: Fri, 14 Sep 2018 04:45:38 -0400

Quoted 10 lines

The function rds_inc_init is in recv process. To use memset can optimize the function rds_inc_init.
The test result:

Before:
1) + 24.950 us | rds_inc_init [rds]();
After:
1) + 10.990 us | rds_inc_init [rds]();

This doesn't apply cleanly to net-next, please respin.

#3 lore raw

OK. I will send V2 for net-next very soon.

Zhu Yanjun

Quoted 16 lines · David Miller

From: Zhu Yanjun <[email protected]>
Date: Fri, 14 Sep 2018 04:45:38 -0400

Quoted 10 lines

The function rds_inc_init is in recv process. To use memset can optimize the function rds_inc_init.
The test result:

Before:
1) + 24.950 us | rds_inc_init [rds]();
After:
1) + 10.990 us | rds_inc_init [rds]();

This doesn't apply cleanly to net-next, please respin.