diff mbox series

[1/1] net: rds: use memset to optimize the recv

Message ID 20180914084538.11666-1-yanjun.zhu@oracle.com (mailing list archive)
State Not Applicable
Headers show
Series [1/1] net: rds: use memset to optimize the recv | expand

Commit Message

Zhu Yanjun Sept. 14, 2018, 8:45 a.m. UTC
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]();

Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 net/rds/recv.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Santosh Shilimkar Sept. 14, 2018, 4:51 p.m. UTC | #1
On 9/14/2018 1:45 AM, Zhu Yanjun wrote:
> 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]();
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
Looks good. Thanks !!

Acked-by: Santosh Shilimkar<santosh.shilimkar@oracle.com>
David Miller Sept. 16, 2018, 10:36 p.m. UTC | #2
From: Zhu Yanjun <yanjun.zhu@oracle.com>
Date: Fri, 14 Sep 2018 04:45:38 -0400

> 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]();
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>

This doesn't apply cleanly to net-next, please respin.
Zhu Yanjun Sept. 17, 2018, 12:54 a.m. UTC | #3
OK. I will send V2 for net-next very soon.

Zhu Yanjun

On Mon, Sep 17, 2018 at 6:38 AM David Miller <davem@davemloft.net> wrote:
>
> From: Zhu Yanjun <yanjun.zhu@oracle.com>
> Date: Fri, 14 Sep 2018 04:45:38 -0400
>
> > 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]();
> >
> > Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
>
> This doesn't apply cleanly to net-next, please respin.
diff mbox series

Patch

diff --git a/net/rds/recv.c b/net/rds/recv.c
index 504cd6bcc54c..a9399ddbb7bf 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -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);