aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/af_inet6.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-11-12 20:24:04 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-14 00:12:26 -0500
commit2a24444f8f2bea694003e3eac5c2f8d9a386bdc5 (patch)
treeef283db22c931c518ac6c0b8bca2e23dd62a7736 /net/ipv6/af_inet6.c
parent3d249d4ca7d0ed6629a135ea1ea21c72286c0d80 (diff)
ipv6: reduce percpu needs for icmpv6msg mibs
Reading /proc/net/snmp6 on a machine with a lot of cpus is very expensive (can be ~88000 us). This is because ICMPV6MSG MIB uses 4096 bytes per cpu, and folding values for all possible cpus can read 16 Mbytes of memory (32MBytes on non x86 arches) ICMP messages are not considered as fast path on a typical server, and eventually few cpus handle them anyway. We can afford an atomic operation instead of using percpu data. This saves 4096 bytes per cpu and per network namespace. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r--net/ipv6/af_inet6.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 1040424c788f..282dc7a91f32 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -985,9 +985,9 @@ static int __net_init ipv6_init_mibs(struct net *net)
985 sizeof(struct icmpv6_mib), 985 sizeof(struct icmpv6_mib),
986 __alignof__(struct icmpv6_mib)) < 0) 986 __alignof__(struct icmpv6_mib)) < 0)
987 goto err_icmp_mib; 987 goto err_icmp_mib;
988 if (snmp_mib_init((void __percpu **)net->mib.icmpv6msg_statistics, 988 net->mib.icmpv6msg_statistics = kzalloc(sizeof(struct icmpv6msg_mib),
989 sizeof(struct icmpv6msg_mib), 989 GFP_KERNEL);
990 __alignof__(struct icmpv6msg_mib)) < 0) 990 if (!net->mib.icmpv6msg_statistics)
991 goto err_icmpmsg_mib; 991 goto err_icmpmsg_mib;
992 return 0; 992 return 0;
993 993
@@ -1008,7 +1008,7 @@ static void ipv6_cleanup_mibs(struct net *net)
1008 snmp_mib_free((void __percpu **)net->mib.udplite_stats_in6); 1008 snmp_mib_free((void __percpu **)net->mib.udplite_stats_in6);
1009 snmp_mib_free((void __percpu **)net->mib.ipv6_statistics); 1009 snmp_mib_free((void __percpu **)net->mib.ipv6_statistics);
1010 snmp_mib_free((void __percpu **)net->mib.icmpv6_statistics); 1010 snmp_mib_free((void __percpu **)net->mib.icmpv6_statistics);
1011 snmp_mib_free((void __percpu **)net->mib.icmpv6msg_statistics); 1011 kfree(net->mib.icmpv6msg_statistics);
1012} 1012}
1013 1013
1014static int __net_init inet6_net_init(struct net *net) 1014static int __net_init inet6_net_init(struct net *net)