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