netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rds: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
@ 2009-04-09  8:02 Wei Yongjun
  2009-04-09 17:43 ` Andy Grover
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2009-04-09  8:02 UTC (permalink / raw)
  To: Andy Grover, David Miller, netdev

Use kmem_cache_zalloc instead of kmem_cache_alloc/memset.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 net/rds/connection.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/rds/connection.c b/net/rds/connection.c
index 273f064..d14445c 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -148,14 +148,12 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
 	if (conn)
 		goto out;
 
-	conn = kmem_cache_alloc(rds_conn_slab, gfp);
+	conn = kmem_cache_zalloc(rds_conn_slab, gfp);
 	if (conn == NULL) {
 		conn = ERR_PTR(-ENOMEM);
 		goto out;
 	}
 
-	memset(conn, 0, sizeof(*conn));
-
 	INIT_HLIST_NODE(&conn->c_hash_node);
 	conn->c_version = RDS_PROTOCOL_3_0;
 	conn->c_laddr = laddr;
-- 
1.5.3.8





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: rds: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
  2009-04-09  8:02 rds: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Wei Yongjun
@ 2009-04-09 17:43 ` Andy Grover
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Grover @ 2009-04-09 17:43 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: David Miller, netdev

Wei Yongjun wrote:
> Use kmem_cache_zalloc instead of kmem_cache_alloc/memset.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> ---
>  net/rds/connection.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/net/rds/connection.c b/net/rds/connection.c
> index 273f064..d14445c 100644
> --- a/net/rds/connection.c
> +++ b/net/rds/connection.c
> @@ -148,14 +148,12 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
>  	if (conn)
>  		goto out;
>  
> -	conn = kmem_cache_alloc(rds_conn_slab, gfp);
> +	conn = kmem_cache_zalloc(rds_conn_slab, gfp);
>  	if (conn == NULL) {
>  		conn = ERR_PTR(-ENOMEM);
>  		goto out;
>  	}
>  
> -	memset(conn, 0, sizeof(*conn));
> -
>  	INIT_HLIST_NODE(&conn->c_hash_node);
>  	conn->c_version = RDS_PROTOCOL_3_0;
>  	conn->c_laddr = laddr;

Thanks, will include in next rds updates!

Regards -- Andy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-09 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-09  8:02 rds: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Wei Yongjun
2009-04-09 17:43 ` Andy Grover

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).