]> www.infradead.org Git - users/jedix/linux-maple.git/commit
inetpeer: do not get a refcount in inet_getpeer()
authorEric Dumazet <edumazet@google.com>
Sun, 15 Dec 2024 17:56:29 +0000 (17:56 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Dec 2024 03:37:48 +0000 (19:37 -0800)
commita853c609504e2d1d83e71285e3622fda1f1451d8
treeb6d9cd4e2333cf6afc87beb0bc7675bc73777006
parent50b362f21d6c10b0f7939c1482c6a1b43da82f1a
inetpeer: do not get a refcount in inet_getpeer()

All inet_getpeer() callers except ip4_frag_init() don't need
to acquire a permanent refcount on the inetpeer.

They can switch to full RCU protection.

Move the refcount_inc_not_zero() into ip4_frag_init(),
so that all the other callers no longer have to
perform a pair of expensive atomic operations on
a possibly contended cache line.

inet_putpeer() no longer needs to be exported.

After this patch, my DUT can receive 8,400,000 UDP packets
per second targeting closed ports, using 50% less cpu cycles
than before.

Also change two calls to l3mdev_master_ifindex() by
l3mdev_master_ifindex_rcu() (Ido ideas)

Fixes: 8c2bd38b95f7 ("icmp: change the order of rate limits")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241215175629.1248773-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/icmp.c
net/ipv4/inetpeer.c
net/ipv4/ip_fragment.c
net/ipv4/route.c
net/ipv6/icmp.c
net/ipv6/ip6_output.c
net/ipv6/ndisc.c