netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup
@ 2015-05-26  7:42 Sorin Dumitru
  2015-05-27 17:33 ` David Miller
  2015-05-27 17:44 ` Cong Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Sorin Dumitru @ 2015-05-26  7:42 UTC (permalink / raw)
  To: netdev; +Cc: davem, Sorin Dumitru, Sorin Dumitru

We're seeing some softlockups from this function when there
are a lot fdb entries on a vxlan device. Taking the lock for
each bucket instead of the whole table is enough to fix that.

Signed-off-by: Sorin Dumitru <sdumitru@ixiacom.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 5eddbc0..34c519e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2131,9 +2131,10 @@ static void vxlan_cleanup(unsigned long arg)
 	if (!netif_running(vxlan->dev))
 		return;
 
-	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);
@@ -2152,8 +2153,8 @@ static void vxlan_cleanup(unsigned long arg)
 			} else if (time_before(timeout, next_timer))
 				next_timer = timeout;
 		}
+		spin_unlock_bh(&vxlan->hash_lock);
 	}
-	spin_unlock_bh(&vxlan->hash_lock);
 
 	mod_timer(&vxlan->age_timer, next_timer);
 }
-- 
2.4.1

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

* Re: [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup
  2015-05-26  7:42 [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup Sorin Dumitru
@ 2015-05-27 17:33 ` David Miller
  2015-05-27 17:44 ` Cong Wang
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-05-27 17:33 UTC (permalink / raw)
  To: sorin; +Cc: netdev, sdumitru

From: Sorin Dumitru <sorin@returnze.ro>
Date: Tue, 26 May 2015 10:42:04 +0300

> We're seeing some softlockups from this function when there
> are a lot fdb entries on a vxlan device. Taking the lock for
> each bucket instead of the whole table is enough to fix that.
> 
> Signed-off-by: Sorin Dumitru <sdumitru@ixiacom.com>

Applied, thanks.

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

* Re: [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup
  2015-05-26  7:42 [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup Sorin Dumitru
  2015-05-27 17:33 ` David Miller
@ 2015-05-27 17:44 ` Cong Wang
  2015-05-27 18:09   ` Sorin Dumitru
  2015-05-27 18:31   ` David Miller
  1 sibling, 2 replies; 5+ messages in thread
From: Cong Wang @ 2015-05-27 17:44 UTC (permalink / raw)
  To: Sorin Dumitru; +Cc: netdev, David Miller, Sorin Dumitru

On Tue, May 26, 2015 at 12:42 AM, Sorin Dumitru <sorin@returnze.ro> wrote:
> We're seeing some softlockups from this function when there
> are a lot fdb entries on a vxlan device. Taking the lock for
> each bucket instead of the whole table is enough to fix that.
>

Hmm, then the spinlock could be moved into each bucket, right?

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

* Re: [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup
  2015-05-27 17:44 ` Cong Wang
@ 2015-05-27 18:09   ` Sorin Dumitru
  2015-05-27 18:31   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Sorin Dumitru @ 2015-05-27 18:09 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, David Miller, Sorin Dumitru

On Wed, May 27, 2015 at 8:44 PM, Cong Wang <cwang@twopensource.com> wrote:
> On Tue, May 26, 2015 at 12:42 AM, Sorin Dumitru <sorin@returnze.ro> wrote:
>> We're seeing some softlockups from this function when there
>> are a lot fdb entries on a vxlan device. Taking the lock for
>> each bucket instead of the whole table is enough to fix that.
>>
>
> Hmm, then the spinlock could be moved into each bucket, right?

Yes, it could, but I'm not sure if it will benefit us too much. I didn't see
too much contention on this lock while adding and removing fdb entries.

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

* Re: [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup
  2015-05-27 17:44 ` Cong Wang
  2015-05-27 18:09   ` Sorin Dumitru
@ 2015-05-27 18:31   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-05-27 18:31 UTC (permalink / raw)
  To: cwang; +Cc: sorin, netdev, sdumitru

From: Cong Wang <cwang@twopensource.com>
Date: Wed, 27 May 2015 10:44:26 -0700

> On Tue, May 26, 2015 at 12:42 AM, Sorin Dumitru <sorin@returnze.ro> wrote:
>> We're seeing some softlockups from this function when there
>> are a lot fdb entries on a vxlan device. Taking the lock for
>> each bucket instead of the whole table is enough to fix that.
>>
> 
> Hmm, then the spinlock could be moved into each bucket, right?

Just because this one big one-time cleanup operation holds the lock
for a long time, doesn't justify making it more granular.

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

end of thread, other threads:[~2015-05-27 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26  7:42 [PATCH net-next] vxlan: release lock after each bucket in vxlan_cleanup Sorin Dumitru
2015-05-27 17:33 ` David Miller
2015-05-27 17:44 ` Cong Wang
2015-05-27 18:09   ` Sorin Dumitru
2015-05-27 18:31   ` 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).