From: Ido Schimmel Date: Tue, 4 Feb 2025 14:55:43 +0000 (+0200) Subject: vxlan: Read jiffies once when updating FDB 'used' time X-Git-Tag: v6.15-rc1~160^2~391^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1370c45d6e7e3cbac4b6dc71f54fd6e167848900;p=thirdparty%2Flinux.git vxlan: Read jiffies once when updating FDB 'used' time Avoid two volatile reads in the data path. Instead, read jiffies once and only if an FDB entry was found. Reviewed-by: Petr Machata Signed-off-by: Ido Schimmel Reviewed-by: Eric Dumazet Reviewed-by: Nikolay Aleksandrov Link: https://patch.msgid.link/20250204145549.1216254-3-idosch@nvidia.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 2f2c6606f7191..676a93ce3a197 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -434,8 +434,12 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, struct vxlan_fdb *f; f = __vxlan_find_mac(vxlan, mac, vni); - if (f && READ_ONCE(f->used) != jiffies) - WRITE_ONCE(f->used, jiffies); + if (f) { + unsigned long now = jiffies; + + if (READ_ONCE(f->used) != now) + WRITE_ONCE(f->used, now); + } return f; }