TUN problems (regression?)
Subsystems (3)
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a kmem_cache_sanity_check() failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.
Have you seen this before?
Signature · 2 lines
paul moore security and virtualization @ redhat
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in tun_flow_init() is wrong...
static int tun_flow_init(struct tun_struct *tun)
{
int i;
tun->flow_cache = kmem_cache_create("tun_flow_cache",
sizeof(struct tun_flow_entry), 0, 0,
NULL);
if (!tun->flow_cache)
return -ENOMEM;...
}
I have no idea why we would need a kmem_cache per tun_struct, and why we even need a kmem_cache.
I would try following patch :
drivers/net/tun.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
drivers/net/tun.c +3 -21
@@ -180,7 +180,6 @@ struct tun_struct {int debug;#endif spinlock_t lock; -struct kmem_cache *flow_cache;struct hlist_head flows[TUN_NUM_FLOW_ENTRIES ];struct timer_list flow_gc_timer;unsigned long ageing_time;
@@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,struct hlist_head *head, u32 rxhash, u16 queue_index) { - struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, -GFP_ATOMIC ); + struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); +if (e) {tun_debug (KERN_INFO , tun,"create flow: hash %u index %u\n" , rxhash, queue_index);
@@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,return e; } -static void tun_flow_free (struct rcu_head *head) -{ -struct tun_flow_entry *e - = container_of(head, struct tun_flow_entry, rcu); -kmem_cache_free (e->tun->flow_cache, e); -} -static void tun_flow_delete (struct tun_struct *tun,struct tun_flow_entry *e) {tun_debug (KERN_INFO , tun,"delete flow: hash %u index %u\n" , e->rxhash, e->queue_index);hlist_del_rcu (&e->hash_link); -call_rcu (&e->rcu, tun_flow_free); +kfree_rcu (e, rcu); }static void tun_flow_flush (struct tun_struct *tun)
@@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun) {int i; - tun->flow_cache =kmem_cache_create ("tun_flow_cache" , -sizeof (struct tun_flow_entry ),0 ,0 , -NULL ); -if (!tun->flow_cache) -return -ENOMEM ; -for (i =0 ; i <TUN_NUM_FLOW_ENTRIES ; i++)INIT_HLIST_HEAD (&tun->flows[i]);
@@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun) {del_timer_sync (&tun->flow_gc_timer);tun_flow_flush (tun); - -/* Wait for completion of call_rcu()'s */ -rcu_barrier (); -kmem_cache_destroy (tun->flow_cache); }/* Initialize net device. */
Stephen Hemminger
Acked-byQuoted 25 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;
Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.
Normally flow malloc/free should be good enough.
It might make sense to use private kmem_cache if doing hlist_nulls.
Jason Wang
Acked-byQuoted 31 lines · Stephen Hemminger
Quoted 28 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;...
}
Quoted 7 lines
Quoted 2 lines
I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.
Should be at least a global cache, I thought I can get some speed-up by using kmem_cache.
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 38 lines · Jason Wang
Quoted 37 lines · Stephen Hemminger
Quoted 24 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.
Quoted 6 lines
Quoted 1 line
Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>
Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated kmem_cache of 48 bytes per object, as we guarantee each object is on a single cache line.
Quoted 40 lines · Eric Dumazet
Quoted 39 lines · Jason Wang
Quoted 38 lines · Stephen Hemminger
Quoted 24 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.
Quoted 10 lines
Quoted 4 lines
Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated
kmem_cacheof 48 bytes per object, as we guarantee each object is on a single cache line.
Right, thanks for the explanation.
Quoted 45 lines · On Fri, 21 Dec 2012 12:26:56 +0800 Jason Wang <[email protected]> wrote:
Quoted 44 lines · Eric Dumazet
Quoted 43 lines · Jason Wang
Quoted 31 lines · Stephen Hemminger
Quoted 28 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;...
}Quoted 7 lines
Quoted 2 lines
I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>
Quoted 9 lines
Quoted 6 lines
Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated
kmem_cacheof 48 bytes per object, as we guarantee each object is on a single cache line.Right, thanks for the explanation.
I wonder if TUN would be better if it used a array to translate receive hash to receive queue. This is how real hardware works with the indirection table, and it would allow RFS acceleration. The current flow cache stuff is prone to DoS attack and scaling problems with lots of short lived flows.
Quoted 54 lines · Stephen Hemminger
Quoted 51 lines · On Fri, 21 Dec 2012 12:26:56 +0800 Jason Wang <[email protected]> wrote:
Quoted 50 lines · Eric Dumazet
Quoted 38 lines · Jason Wang
Quoted 37 lines · Stephen Hemminger
Quoted 24 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.Quoted 5 lines
Quoted 1 line
Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated
kmem_cacheof 48 bytes per object, as we guarantee each object is on a single cache line.
Quoted 7 lines
Quoted 2 lines
Right, thanks for the explanation.
I wonder if TUN would be better if it used a array to translate receive hash to receive queue. This is how real hardware works with the indirection table, and it would allow RFS acceleration. The current flow cache stuff is prone to DoS attack and scaling problems with lots of short lived flows.
The problem of indirection table is hash collision which may even happen when few flows existed.
For the RFS, we can open a API/ioctl for userspace to add or remove a flow cache.
For the DoS/scaling issue, I have an idea of:
- limit the total number of flow entries in tun/tap
- only update the flow entry every N (say 20 like ixgbe) packets or the the tcp packet has sync flag
- I'm not sure skb_get_rxhash() is lightweight enough, or change to more lightweight one?
Any suggestions?
Thanks
Quoted 57 lines · On Fri, 28 Dec 2012 13:43:54 +0800 Jason Wang <[email protected]> wrote:
Quoted 56 lines · Stephen Hemminger
Quoted 53 lines · On Fri, 21 Dec 2012 12:26:56 +0800 Jason Wang <[email protected]> wrote:
Quoted 40 lines · Eric Dumazet
Quoted 39 lines · Jason Wang
Quoted 38 lines · Stephen Hemminger
Quoted 24 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.Quoted 10 lines
Quoted 4 lines
Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated
kmem_cacheof 48 bytes per object, as we guarantee each object is on a single cache line.Right, thanks for the explanation.
Quoted 8 lines
Quoted 5 lines
I wonder if TUN would be better if it used a array to translate receive hash to receive queue. This is how real hardware works with the indirection table, and it would allow RFS acceleration. The current flow cache stuff is prone to DoS attack and scaling problems with lots of short lived flows.
The problem of indirection table is hash collision which may even happen when few flows existed.
Hash collision is fine, as long as the the statistical average of hash across queue's is approximately equal it will be faster. A simple array indirection is much faster than walking a hash table.
Quoted 2 lines
For the RFS, we can open a API/ioctl for userspace to add or remove a flow cache.
RFS acceleration relies on programming the table. It is easier if TUN looks more like hardware.
Quoted 6 lines
For the DoS/scaling issue, I have an idea of:
- limit the total number of flow entries in tun/tap
- only update the flow entry every N (say 20 like ixgbe) packets or the the tcp packet has sync flag
- I'm not sureskb_get_rxhash()is lightweight enough, or change to more lightweight one?
Ideally the hash should be programmable L2 vs L3, but that is splitting hairs at this point.
Flow tables are scaling problem, especially on highly loaded servers where they are most needed.
Quoted 65 lines · Stephen Hemminger
Quoted 62 lines · On Fri, 28 Dec 2012 13:43:54 +0800 Jason Wang <[email protected]> wrote:
Quoted 61 lines · Stephen Hemminger
Quoted 44 lines · On Fri, 21 Dec 2012 12:26:56 +0800 Jason Wang <[email protected]> wrote:
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jason Wang
Quoted 31 lines · Stephen Hemminger
Quoted 28 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;...
}Quoted 7 lines
Quoted 2 lines
I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Quoted 9 lines
Quoted 7 lines
Quoted 1 line
Acked-by Jason Wang <[email protected]>Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated
kmem_cacheof 48 bytes per object, as we guarantee each object is on a single cache line.Right, thanks for the explanation.
I wonder if TUN would be better if it used a array to translate receive hash to receive queue. This is how real hardware works with the indirection table, and it would allow RFS acceleration. The current flow cache stuff is prone to DoS attack and scaling problems with lots of short lived flows.
Quoted 5 lines
Quoted 2 lines
The problem of indirection table is hash collision which may even happen when few flows existed.
Hash collision is fine, as long as the the statistical average of hash across queue's is approximately equal it will be faster. A simple array indirection is much faster than walking a hash table.
True, but hash collision may cause some negative effects such as losing the flow affinity and packet re-ordering in guest which does not exist in a perfect filter. Maybe we can implement them both and let user to choose.
Quoted 22 lines
Quoted 3 lines
For the RFS, we can open a API/ioctl for userspace to add or remove a flow cache.
RFS acceleration relies on programming the table. It is easier if TUN looks more like hardware.
Quoted 6 lines
For the DoS/scaling issue, I have an idea of:
- limit the total number of flow entries in tun/tap
- only update the flow entry every N (say 20 like ixgbe) packets or the the tcp packet has sync flag
- I'm not sureskb_get_rxhash()is lightweight enough, or change to more lightweight one?Ideally the hash should be programmable L2 vs L3, but that is splitting hairs at this point.
Flow tables are scaling problem, especially on highly loaded servers where they are most needed.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Jason Wang <[email protected]>
Date: Fri, 21 Dec 2012 11:32:43 +0800
Quoted 38 lines · Stephen Hemminger
Quoted 37 lines
Quoted 24 lines · On Thu, 20 Dec 2012 15:38:17 -0800 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
Quoted 8 lines
I started doing some more testing with the multiqueue TUN changes and I ran into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and a
kmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;Quoted 6 lines
...
}I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.Normally flow malloc/free should be good enough.
It might make sense to use privatekmem_cacheif doinghlist_nulls.
Quoted 6 lines
Quoted 1 line
Should be at least a global cache, I thought I can get some speed-up by using
kmem_cache.Acked-by Jason Wang <[email protected]>
Applied.
Quoted 30 lines · Eric Dumazet
Quoted 12 lines · Paul Moore
[CC'ing netdev in case this is a known problem I just missed ...]
Hi Jason,
I started doing some more testing with the multiqueue TUN changes and I ran
into a problem when running tunctl: running it once w/o arguments works as expected, but running it a second time results in failure and akmem_cache_sanity_check()failure. The problem appears to be very repeatable on my test VM and happens independent of the LSM/SELinux fixup patches.Quoted 1 line
Have you seen this before?
Obviously code in
tun_flow_init()is wrong...static int
tun_flow_init(struct tun_struct *tun){ int i; tun->flow_cache = kmem_cache_create("tun_flow_cache", sizeof(struct tun_flow_entry), 0, 0, NULL); if (!tun->flow_cache) return -ENOMEM;...
}
Quoted 8 lines
I have no idea why we would need a
kmem_cachepertun_struct, and why we even need akmem_cache.I would try following patch :
drivers/net/tun.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
Thanks, that solved my problem. Also, in case you were still curious, I was using SLUB.
Signature · 2 lines
paul moore security and virtualization @ redhat
PATCH 1/1 tuntap: dont use a private kmem_cache
From: Eric Dumazet <[email protected]>
Commit 96442e42429 (tuntap: choose the txq based on rxq) added a per tun_struct kmem_cache.
As soon as several tun_struct are used, we get an error because two caches cannot have same name.
Use the default kmalloc()/kfree_rcu(), as it reduce code size and doesn't have performance impact here.
--- drivers/net/tun.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
drivers/net/tun.c +3 -21
@@ -180,7 +180,6 @@ struct tun_struct {int debug;#endif spinlock_t lock; -struct kmem_cache *flow_cache;struct hlist_head flows[TUN_NUM_FLOW_ENTRIES ];struct timer_list flow_gc_timer;unsigned long ageing_time;
@@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,struct hlist_head *head, u32 rxhash, u16 queue_index) { - struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, -GFP_ATOMIC ); + struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); +if (e) {tun_debug (KERN_INFO , tun,"create flow: hash %u index %u\n" , rxhash, queue_index);
@@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,return e; } -static void tun_flow_free (struct rcu_head *head) -{ -struct tun_flow_entry *e - = container_of(head, struct tun_flow_entry, rcu); -kmem_cache_free (e->tun->flow_cache, e); -} -static void tun_flow_delete (struct tun_struct *tun,struct tun_flow_entry *e) {tun_debug (KERN_INFO , tun,"delete flow: hash %u index %u\n" , e->rxhash, e->queue_index);hlist_del_rcu (&e->hash_link); -call_rcu (&e->rcu, tun_flow_free); +kfree_rcu (e, rcu); }static void tun_flow_flush (struct tun_struct *tun)
@@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun) {int i; - tun->flow_cache =kmem_cache_create ("tun_flow_cache" , -sizeof (struct tun_flow_entry ),0 ,0 , -NULL ); -if (!tun->flow_cache) -return -ENOMEM ; -for (i =0 ; i <TUN_NUM_FLOW_ENTRIES ; i++)INIT_HLIST_HEAD (&tun->flows[i]);
@@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun) {del_timer_sync (&tun->flow_gc_timer);tun_flow_flush (tun); - -/* Wait for completion of call_rcu()'s */ -rcu_barrier (); -kmem_cache_destroy (tun->flow_cache); }/* Initialize net device. */