* [PATCH] vxlan: using hash_lock to protect one budegt in vxlan_flush
@ 2019-04-11 7:06 Litao Jiao
2019-04-12 4:30 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Litao Jiao @ 2019-04-11 7:06 UTC (permalink / raw)
To: davem; +Cc: petrm, idosch, roopa, sbrivio, netdev, linux-kernel, jiaolitao
The hash_lock will hold long time in vxlan_flush when stopping the
vxlan device in which there has lots of vxlan fdb entries;it would
affect the bh process in local cpu; and other cpu would wait for
a long time in vxlan_snoop until the hash_lock is released;so
using hash_lock to protect one budegt in vxlan_flush could
reduce the continuous holding time of the lock.
Signed-off-by: Litao Jiao <jiaolitao@raisecom.com>
---
drivers/net/vxlan.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d76dfed..306703e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2816,9 +2816,10 @@ static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
{
unsigned int h;
- spin_lock_bh(&vxlan->hash_lock);
for (h = 0; h < FDB_HASH_SIZE; ++h) {
struct hlist_node *p, *n;
+
+ spin_lock_bh(&vxlan->hash_lock);
hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
struct vxlan_fdb *f
= container_of(p, struct vxlan_fdb, hlist);
@@ -2828,8 +2829,8 @@ static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
if (!is_zero_ether_addr(f->eth_addr))
vxlan_fdb_destroy(vxlan, f, true, true);
}
+ spin_unlock_bh(&vxlan->hash_lock);
}
- spin_unlock_bh(&vxlan->hash_lock);
}
/* Cleanup timer and forwarding table on shutdown */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vxlan: using hash_lock to protect one budegt in vxlan_flush
2019-04-11 7:06 [PATCH] vxlan: using hash_lock to protect one budegt in vxlan_flush Litao Jiao
@ 2019-04-12 4:30 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-04-12 4:30 UTC (permalink / raw)
To: jiaolitao; +Cc: petrm, idosch, roopa, sbrivio, netdev, linux-kernel
From: Litao Jiao <jiaolitao@raisecom.com>
Date: Thu, 11 Apr 2019 15:06:09 +0800
> The hash_lock will hold long time in vxlan_flush when stopping the
> vxlan device in which there has lots of vxlan fdb entries;it would
> affect the bh process in local cpu; and other cpu would wait for
> a long time in vxlan_snoop until the hash_lock is released;so
> using hash_lock to protect one budegt in vxlan_flush could
> reduce the continuous holding time of the lock.
>
> Signed-off-by: Litao Jiao <jiaolitao@raisecom.com>
Now you are doing FDB_HASH_SIZE spin lock/unlock sequences.
There has to be a better way.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-12 4:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 7:06 [PATCH] vxlan: using hash_lock to protect one budegt in vxlan_flush Litao Jiao
2019-04-12 4:30 ` 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).