All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <andrew+netdev@lunn.ch>,
	<horms@kernel.org>, <petrm@nvidia.com>, <razor@blackwall.org>,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 2/8] vxlan: Read jiffies once when updating FDB 'used' time
Date: Tue, 4 Feb 2025 16:55:43 +0200	[thread overview]
Message-ID: <20250204145549.1216254-3-idosch@nvidia.com> (raw)
In-Reply-To: <20250204145549.1216254-1-idosch@nvidia.com>

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>
---
 drivers/net/vxlan/vxlan_core.c | 8 ++++++--
 1 file 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;
 }
-- 
2.48.1


  parent reply	other threads:[~2025-02-04 14:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 14:55 [PATCH net-next 0/8] vxlan: Age FDB entries based on Rx traffic Ido Schimmel
2025-02-04 14:55 ` [PATCH net-next 1/8] vxlan: Annotate FDB data races Ido Schimmel
2025-02-04 15:41   ` Eric Dumazet
2025-02-04 16:36   ` Nikolay Aleksandrov
2025-02-04 14:55 ` Ido Schimmel [this message]
2025-02-04 15:42   ` [PATCH net-next 2/8] vxlan: Read jiffies once when updating FDB 'used' time Eric Dumazet
2025-02-04 16:36   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 3/8] vxlan: Always refresh FDB 'updated' time when learning is enabled Ido Schimmel
2025-02-04 16:37   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 4/8] vxlan: Refresh FDB 'updated' time upon 'NTF_USE' Ido Schimmel
2025-02-04 16:37   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 5/8] vxlan: Refresh FDB 'updated' time upon user space updates Ido Schimmel
2025-02-04 16:37   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 6/8] vxlan: Age out FDB entries based on 'updated' time Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 7/8] vxlan: Avoid unnecessary updates to FDB 'used' time Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 8/8] selftests: forwarding: vxlan_bridge_1d: Check aging while forwarding Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-06  4:40 ` [PATCH net-next 0/8] vxlan: Age FDB entries based on Rx traffic patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250204145549.1216254-3-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.