aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-05-18 21:14:23 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-19 16:21:22 -0400
commitbe281e554e2a4cf2478df7a8b8926c89454bccfa (patch)
tree7e80e5eb0aa76efcdb39a06413ff9e0ae73de35a /include/net/ipv6.h
parent75e308c894c4a5e47c005b8e821ae5f539ad2ef3 (diff)
ipv6: reduce per device ICMP mib sizes
ipv6 has per device ICMP SNMP counters, taking too much space because they use percpu storage. needed size per device is : (512+4)*sizeof(long)*number_of_possible_cpus*2 On a 32bit kernel, 16 possible cpus, this wastes more than 64kbytes of memory per ipv6 enabled network device, taken in vmalloc pool. Since ICMP messages are rare, just use shared counters (atomic_long_t) Per network space ICMP counters are still using percpu memory, we might also convert them to shared counters in a future patch. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Denys Fedoryshchenko <denys@visp.net.lb> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e1c60b43e73b..c033ed00df7d 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -123,6 +123,15 @@ extern struct ctl_path net_ipv6_ctl_path[];
123 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ 123 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
124}) 124})
125 125
126/* per device counters are atomic_long_t */
127#define _DEVINCATOMIC(net, statname, modifier, idev, field) \
128({ \
129 struct inet6_dev *_idev = (idev); \
130 if (likely(_idev != NULL)) \
131 SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \
132 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
133})
134
126#define _DEVADD(net, statname, modifier, idev, field, val) \ 135#define _DEVADD(net, statname, modifier, idev, field, val) \
127({ \ 136({ \
128 struct inet6_dev *_idev = (idev); \ 137 struct inet6_dev *_idev = (idev); \
@@ -154,16 +163,16 @@ extern struct ctl_path net_ipv6_ctl_path[];
154#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ 163#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
155 _DEVUPD(net, ipv6, 64_BH, idev, field, val) 164 _DEVUPD(net, ipv6, 64_BH, idev, field, val)
156#define ICMP6_INC_STATS(net, idev, field) \ 165#define ICMP6_INC_STATS(net, idev, field) \
157 _DEVINC(net, icmpv6, , idev, field) 166 _DEVINCATOMIC(net, icmpv6, , idev, field)
158#define ICMP6_INC_STATS_BH(net, idev, field) \ 167#define ICMP6_INC_STATS_BH(net, idev, field) \
159 _DEVINC(net, icmpv6, _BH, idev, field) 168 _DEVINCATOMIC(net, icmpv6, _BH, idev, field)
160 169
161#define ICMP6MSGOUT_INC_STATS(net, idev, field) \ 170#define ICMP6MSGOUT_INC_STATS(net, idev, field) \
162 _DEVINC(net, icmpv6msg, , idev, field +256) 171 _DEVINCATOMIC(net, icmpv6msg, , idev, field +256)
163#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ 172#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \
164 _DEVINC(net, icmpv6msg, _BH, idev, field +256) 173 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256)
165#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ 174#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
166 _DEVINC(net, icmpv6msg, _BH, idev, field) 175 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field)
167 176
168struct ip6_ra_chain { 177struct ip6_ra_chain {
169 struct ip6_ra_chain *next; 178 struct ip6_ra_chain *next;