diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-05-05 18:55:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-07 16:06:05 -0400 |
commit | 698365fa1874aa7635d51667a34a2842228e9837 (patch) | |
tree | 13230edeac756a36260bb2aef5d1b1da0cada7f9 /net/sctp | |
parent | d1f88a667c16e38d5a796b5fcdfd4ddbac1f638f (diff) |
net: clean up snmp stats code
commit 8f0ea0fe3a036a47767f9c80e (snmp: reduce percpu needs by 50%)
reduced snmp array size to 1, so technically it doesn't have to be
an array any more. What's more, after the following commit:
commit 933393f58fef9963eac61db8093689544e29a600
Date: Thu Dec 22 11:58:51 2011 -0600
percpu: Remove irqsafe_cpu_xxx variants
We simply say that regular this_cpu use must be safe regardless of
preemption and interrupt state. That has no material change for x86
and s390 implementations of this_cpu operations. However, arches that
do not provide their own implementation for this_cpu operations will
now get code generated that disables interrupts instead of preemption.
probably no arch wants to have SNMP_ARRAY_SZ == 2. At least after
almost 3 years, no one complains.
So, just convert the array to a single pointer and remove snmp_mib_init()
and snmp_mib_free() as well.
Cc: Christoph Lameter <cl@linux.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/protocol.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index c09757fbf803..074b60e2faab 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1100,14 +1100,15 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family) | |||
1100 | 1100 | ||
1101 | static inline int init_sctp_mibs(struct net *net) | 1101 | static inline int init_sctp_mibs(struct net *net) |
1102 | { | 1102 | { |
1103 | return snmp_mib_init((void __percpu **)net->sctp.sctp_statistics, | 1103 | net->sctp.sctp_statistics = alloc_percpu(struct sctp_mib); |
1104 | sizeof(struct sctp_mib), | 1104 | if (!net->sctp.sctp_statistics) |
1105 | __alignof__(struct sctp_mib)); | 1105 | return -ENOMEM; |
1106 | return 0; | ||
1106 | } | 1107 | } |
1107 | 1108 | ||
1108 | static inline void cleanup_sctp_mibs(struct net *net) | 1109 | static inline void cleanup_sctp_mibs(struct net *net) |
1109 | { | 1110 | { |
1110 | snmp_mib_free((void __percpu **)net->sctp.sctp_statistics); | 1111 | free_percpu(net->sctp.sctp_statistics); |
1111 | } | 1112 | } |
1112 | 1113 | ||
1113 | static void sctp_v4_pf_init(void) | 1114 | static void sctp_v4_pf_init(void) |