Re: [Xen-devel] [PATCH -next] xen-netback: using kfree_rcu() to simplify the code

2016-08-23 Thread David Miller
From: Wei Yongjun 
Date: Mon, 22 Aug 2016 23:01:29 +

> From: Wei Yongjun 
> 
> 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 

Applied.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH -next] xen-netback: using kfree_rcu() to simplify the code

2016-08-22 Thread Wei Yongjun
From: Wei Yongjun 

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 
---
 drivers/net/xen-netback/hash.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
index 282b16d..e8c5ddd 100644
--- a/drivers/net/xen-netback/hash.c
+++ b/drivers/net/xen-netback/hash.c
@@ -32,15 +32,6 @@
 #include 
 #include 
 
-static void xenvif_del_hash(struct rcu_head *rcu)
-{
-   struct xenvif_hash_cache_entry *entry;
-
-   entry = container_of(rcu, struct xenvif_hash_cache_entry, rcu);
-
-   kfree(entry);
-}
-
 static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
unsigned int len, u32 val)
 {
@@ -76,7 +67,7 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
if (++vif->hash.cache.count > xenvif_hash_cache_size) {
list_del_rcu(>link);
vif->hash.cache.count--;
-   call_rcu(>rcu, xenvif_del_hash);
+   kfree_rcu(oldest, rcu);
}
}
 
@@ -114,7 +105,7 @@ static void xenvif_flush_hash(struct xenvif *vif)
list_for_each_entry_rcu(entry, >hash.cache.list, link) {
list_del_rcu(>link);
vif->hash.cache.count--;
-   call_rcu(>rcu, xenvif_del_hash);
+   kfree_rcu(entry, rcu);
}
 
spin_unlock_irqrestore(>hash.cache.lock, flags);




___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel