diff options
author | 2025-02-04 16:55:43 +0200 | |
---|---|---|
committer | 2025-02-05 18:53:57 -0800 | |
commit | 1370c45d6e7e3cbac4b6dc71f54fd6e167848900 (patch) | |
tree | 357247b5350ca57475cbd3f4623db9f18cae3a7d | |
parent | vxlan: Annotate FDB data races (diff) | |
download | wireguard-linux-1370c45d6e7e3cbac4b6dc71f54fd6e167848900.tar.xz wireguard-linux-1370c45d6e7e3cbac4b6dc71f54fd6e167848900.zip |
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 <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20250204145549.1216254-3-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/vxlan/vxlan_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 2f2c6606f719..676a93ce3a19 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; } |