mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
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>
This commit is contained in:
parent
f6205f8215
commit
1370c45d6e
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user