From: Li RongQing <lirongqing@baidu.com>
Date: Wed, 29 Aug 2018 03:52:10 +0000 (+0800)
Subject: vxlan: reduce dirty cache line in vxlan_find_mac
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=016f3d1818b047c80100d92f023916f9c8d34d3c;p=linux.git

vxlan: reduce dirty cache line in vxlan_find_mac

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ababba37d735d..e5d236595206b 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;