diff mbox series

[net-next] vxlan: reduce dirty cache line in vxlan_find_mac

Message ID 1535514730-21032-1-git-send-email-lirongqing@baidu.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net-next] vxlan: reduce dirty cache line in vxlan_find_mac | expand

Commit Message

Li RongQing Aug. 29, 2018, 3:52 a.m. UTC
vxlan_find_mac() unconditionally set f->used for every packet,
this causes a cache miss for every packet, since remote, hlist
and used of vxlan_fdb share the same cache line, which are
accessed when send every packets.

so f->used is set only if not equal to jiffies, to reduce dirty
cache line times, this gives 3% speed-up with small packets.

Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Aug. 30, 2018, 5:08 a.m. UTC | #1
From: Li RongQing <lirongqing@baidu.com>
Date: Wed, 29 Aug 2018 11:52:10 +0800

> vxlan_find_mac() unconditionally set f->used for every packet,
> this causes a cache miss for every packet, since remote, hlist
> and used of vxlan_fdb share the same cache line, which are
> accessed when send every packets.
> 
> so f->used is set only if not equal to jiffies, to reduce dirty
> cache line times, this gives 3% speed-up with small packets.
> 
> Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied.
diff mbox series

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ababba37d735..e5d236595206 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -464,7 +464,7 @@  static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
 	struct vxlan_fdb *f;
 
 	f = __vxlan_find_mac(vxlan, mac, vni);
-	if (f)
+	if (f && f->used != jiffies)
 		f->used = jiffies;
 
 	return f;