netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] vxlan: using kfree_rcu() to simplify the code
@ 2013-08-16 23:32 Wei Yongjun
  2013-08-16 23:45 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Yongjun @ 2013-08-16 23:32 UTC (permalink / raw)
  To: davem, stephen, pshelar, mike.rapoport, amwang; +Cc: yongjun_wei, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/vxlan.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 227b54a..d6fc046 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -498,12 +498,6 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 	return 0;
 }
 
-static void vxlan_fdb_free_rdst(struct rcu_head *head)
-{
-	struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
-	kfree(rd);
-}
-
 static void vxlan_fdb_free(struct rcu_head *head)
 {
 	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
@@ -643,7 +637,7 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
 	 */
 	if (rd && !list_is_singular(&f->remotes)) {
 		list_del_rcu(&rd->list);
-		call_rcu(&rd->rcu, vxlan_fdb_free_rdst);
+		kfree_rcu(rd, rcu);
 		goto out;
 	}
 

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

* Re: [PATCH -next] vxlan: using kfree_rcu() to simplify the code
  2013-08-16 23:32 [PATCH -next] vxlan: using kfree_rcu() to simplify the code Wei Yongjun
@ 2013-08-16 23:45 ` Stephen Hemminger
  2013-08-20 22:06   ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2013-08-16 23:45 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: davem, pshelar, mike.rapoport, amwang, yongjun_wei, netdev

On Sat, 17 Aug 2013 07:32:09 +0800
Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The callback function of call_rcu() just calls a kfree(), so we
> can use kfree_rcu() instead of call_rcu() + callback function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/net/vxlan.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 227b54a..d6fc046 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -498,12 +498,6 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
>  	return 0;
>  }
>  
> -static void vxlan_fdb_free_rdst(struct rcu_head *head)
> -{
> -	struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
> -	kfree(rd);
> -}
> -
>  static void vxlan_fdb_free(struct rcu_head *head)
>  {
>  	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
> @@ -643,7 +637,7 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
>  	 */
>  	if (rd && !list_is_singular(&f->remotes)) {
>  		list_del_rcu(&rd->list);
> -		call_rcu(&rd->rcu, vxlan_fdb_free_rdst);
> +		kfree_rcu(rd, rcu);
>  		goto out;
>  	}
>  
> 

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH -next] vxlan: using kfree_rcu() to simplify the code
  2013-08-16 23:45 ` Stephen Hemminger
@ 2013-08-20 22:06   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-08-20 22:06 UTC (permalink / raw)
  To: stephen; +Cc: weiyj.lk, pshelar, mike.rapoport, amwang, yongjun_wei, netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 16 Aug 2013 16:45:44 -0700

> On Sat, 17 Aug 2013 07:32:09 +0800
> Wei Yongjun <weiyj.lk@gmail.com> wrote:
> 
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> 
>> The callback function of call_rcu() just calls a kfree(), so we
>> can use kfree_rcu() instead of call_rcu() + callback function.
>> 
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
 ...
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied.

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

* Re: [PATCH -next] vxlan: using kfree_rcu() to simplify the code
  2013-07-17  5:29 Wei Yongjun
@ 2013-07-17  6:01 ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-07-17  6:01 UTC (permalink / raw)
  To: weiyj.lk; +Cc: stephen, pshelar, mike.rapoport, amwang, yongjun_wei, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Wed, 17 Jul 2013 13:29:58 +0800

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The callback function of call_rcu() just calls a kfree(), so we
> can use kfree_rcu() instead of call_rcu() + callback function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

net-next is not open yet, please resubmit this when I announce here
on netdev that the net-next tree is open for submissions.

Thank you.

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

* [PATCH -next] vxlan: using kfree_rcu() to simplify the code
@ 2013-07-17  5:29 Wei Yongjun
  2013-07-17  6:01 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Yongjun @ 2013-07-17  5:29 UTC (permalink / raw)
  To: davem, stephen, pshelar, mike.rapoport, amwang; +Cc: yongjun_wei, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/vxlan.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 227b54a..d6fc046 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -498,12 +498,6 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 	return 0;
 }
 
-static void vxlan_fdb_free_rdst(struct rcu_head *head)
-{
-	struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
-	kfree(rd);
-}
-
 static void vxlan_fdb_free(struct rcu_head *head)
 {
 	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
@@ -643,7 +637,7 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
 	 */
 	if (rd && !list_is_singular(&f->remotes)) {
 		list_del_rcu(&rd->list);
-		call_rcu(&rd->rcu, vxlan_fdb_free_rdst);
+		kfree_rcu(rd, rcu);
 		goto out;
 	}
 

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

end of thread, other threads:[~2013-08-20 22:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 23:32 [PATCH -next] vxlan: using kfree_rcu() to simplify the code Wei Yongjun
2013-08-16 23:45 ` Stephen Hemminger
2013-08-20 22:06   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-07-17  5:29 Wei Yongjun
2013-07-17  6:01 ` David Miller

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).