Skip to content

Commit 05a94d4

Browse files
committed
net: Remove likely from l3mdev_master_ifindex_by_index
JIRA: https://issues.redhat.com/browse/RHEL-84551 Upstream Status: linux.git commit 9e542ff Author: Breno Leitao <leitao@debian.org> Date: Tue Oct 8 09:32:04 2024 -0700 net: Remove likely from l3mdev_master_ifindex_by_index The likely() annotation in l3mdev_master_ifindex_by_index() has been found to be incorrect 100% of the time in real-world workloads (e.g., web servers). Annotated branches shows the following in these servers: correct incorrect % Function File Line 0 169053813 100 l3mdev_master_ifindex_by_index l3mdev.h 81 This is happening because l3mdev_master_ifindex_by_index() is called from __inet_check_established(), which calls l3mdev_master_ifindex_by_index() passing the socked bounded interface. l3mdev_master_ifindex_by_index(net, sk->sk_bound_dev_if); Since most sockets are not going to be bound to a network device, the likely() is giving the wrong assumption. Remove the likely() annotation to ensure more accurate branch prediction. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20241008163205.3939629-1-leitao@debian.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent d85f34b commit 05a94d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/l3mdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static inline int l3mdev_master_ifindex_by_index(struct net *net, int ifindex)
7878
struct net_device *dev;
7979
int rc = 0;
8080

81-
if (likely(ifindex)) {
81+
if (ifindex) {
8282
rcu_read_lock();
8383

8484
dev = dev_get_by_index_rcu(net, ifindex);

0 commit comments

Comments
 (0)