aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
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 /include/net/ipv6.h
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 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a366a8a1fe23..3f0258d2ef01 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -132,6 +132,15 @@ extern struct ctl_path net_ipv6_ctl_path[];
132 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ 132 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
133}) 133})
134 134
135/* per device and per net counters are atomic_long_t */
136#define _DEVINC_ATOMIC_ATOMIC(net, statname, idev, field) \
137({ \
138 struct inet6_dev *_idev = (idev); \
139 if (likely(_idev != NULL)) \
140 SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \
141 SNMP_INC_STATS_ATOMIC_LONG((net)->mib.statname##_statistics, (field));\
142})
143
135#define _DEVADD(net, statname, modifier, idev, field, val) \ 144#define _DEVADD(net, statname, modifier, idev, field, val) \
136({ \ 145({ \
137 struct inet6_dev *_idev = (idev); \ 146 struct inet6_dev *_idev = (idev); \
@@ -168,11 +177,11 @@ extern struct ctl_path net_ipv6_ctl_path[];
168 _DEVINCATOMIC(net, icmpv6, _BH, idev, field) 177 _DEVINCATOMIC(net, icmpv6, _BH, idev, field)
169 178
170#define ICMP6MSGOUT_INC_STATS(net, idev, field) \ 179#define ICMP6MSGOUT_INC_STATS(net, idev, field) \
171 _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) 180 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
172#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ 181#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \
173 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) 182 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
174#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ 183#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
175 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) 184 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field)
176 185
177struct ip6_ra_chain { 186struct ip6_ra_chain {
178 struct ip6_ra_chain *next; 187 struct ip6_ra_chain *next;