]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
inet: move icmp_global_{credit,stamp} to a separate cache line
authorEric Dumazet <edumazet@google.com>
Mon, 16 Feb 2026 14:28:29 +0000 (14:28 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Feb 2026 00:46:36 +0000 (16:46 -0800)
icmp_global_credit was meant to be changed ~1000 times per second,
but if an admin sets net.ipv4.icmp_msgs_per_sec to a very high value,
icmp_global_credit changes can inflict false sharing to surrounding
fields that are read mostly.

Move icmp_global_credit and icmp_global_stamp to a separate
cacheline aligned group.

Fixes: b056b4cd9178 ("icmp: move icmp_global.credit and icmp_global.stamp to per netns storage")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260216142832.3834174-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/netns/ipv4.h

index 2dbd46fc4734b78201818ecf6065237d475101ce..8e971c7bf164642344f40a07e021b0037f27ee7d 100644 (file)
@@ -88,6 +88,12 @@ struct netns_ipv4 {
        int sysctl_tcp_rcvbuf_low_rtt;
        __cacheline_group_end(netns_ipv4_read_rx);
 
+       /* ICMP rate limiter hot cache line. */
+       __cacheline_group_begin_aligned(icmp);
+       atomic_t        icmp_global_credit;
+       u32             icmp_global_stamp;
+       __cacheline_group_end_aligned(icmp);
+
        struct inet_timewait_death_row tcp_death_row;
        struct udp_table *udp_table;
 
@@ -141,8 +147,7 @@ struct netns_ipv4 {
        int sysctl_icmp_ratemask;
        int sysctl_icmp_msgs_per_sec;
        int sysctl_icmp_msgs_burst;
-       atomic_t icmp_global_credit;
-       u32 icmp_global_stamp;
+
        u32 ip_rt_min_pmtu;
        int ip_rt_mtu_expires;
        int ip_rt_min_advmss;