net: rds: use memset to optimize the recv
authorZhu Yanjun <yanjun.zhu@oracle.com>
Mon, 17 Sep 2018 02:49:30 +0000 (22:49 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Sep 2018 15:19:51 +0000 (08:19 -0700)
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]();

Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/recv.c

index 12719653188a300d5b5812a3997451dfe61aa826..727639dac8a7f4e88482938c11b711132d09f3b5 100644 (file)
@@ -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;
@@ -52,8 +50,7 @@ void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
        inc->i_rdma_cookie = 0;
        inc->i_rx_tstamp = ktime_set(0, 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);