aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-11-08 08:04:43 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-09 16:04:20 -0500
commitacb32ba3dee66d58704caeeb8c6ff95f60efdc66 (patch)
treeb5c1d6d5575a7b75c7c816e0809690f58401715c /include
parente56c57d0d3fdbbdf583d3af96bfb803b8dfa713e (diff)
ipv4: reduce percpu needs for icmpmsg mibs
Reading /proc/net/snmp on a machine with a lot of cpus is very expensive (can be ~88000 us). This is because ICMPMSG MIB uses 4096 bytes per cpu, and folding values for all possible cpus can read 16 Mbytes of memory. 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 'include')
-rw-r--r--include/net/icmp.h4
-rw-r--r--include/net/netns/mib.h2
-rw-r--r--include/net/snmp.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/include/net/icmp.h b/include/net/icmp.h
index f0698b955b73..75d615649071 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -31,8 +31,8 @@ struct icmp_err {
31extern const struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) 33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) 34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256)
35#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmpmsg_statistics, field) 35#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field)
36 36
37struct dst_entry; 37struct dst_entry;
38struct net_proto_family; 38struct net_proto_family;
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 0b44112e2366..f360135cb69f 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -10,7 +10,7 @@ struct netns_mib {
10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); 10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
13 DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); 13 DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics);
14 14
15#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 15#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
16 struct proc_dir_entry *proc_net_devsnmp6; 16 struct proc_dir_entry *proc_net_devsnmp6;
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 8f0f9ac0307f..0feafa68da01 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -67,7 +67,7 @@ struct icmp_mib {
67 67
68#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX 68#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
69struct icmpmsg_mib { 69struct icmpmsg_mib {
70 unsigned long mibs[ICMPMSG_MIB_MAX]; 70 atomic_long_t mibs[ICMPMSG_MIB_MAX];
71}; 71};
72 72
73/* ICMP6 (IPv6-ICMP) */ 73/* ICMP6 (IPv6-ICMP) */