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/xfrm | |
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/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 10 | ||||
-rw-r--r-- | net/xfrm/xfrm_proc.c | 3 |
2 files changed, 5 insertions, 8 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index c08fbd11ceff..e63f242ae03e 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2783,21 +2783,19 @@ static struct notifier_block xfrm_dev_notifier = { | |||
2783 | static int __net_init xfrm_statistics_init(struct net *net) | 2783 | static int __net_init xfrm_statistics_init(struct net *net) |
2784 | { | 2784 | { |
2785 | int rv; | 2785 | int rv; |
2786 | 2786 | net->mib.xfrm_statistics = alloc_percpu(struct linux_xfrm_mib); | |
2787 | if (snmp_mib_init((void __percpu **)net->mib.xfrm_statistics, | 2787 | if (!net->mib.xfrm_statistics) |
2788 | sizeof(struct linux_xfrm_mib), | ||
2789 | __alignof__(struct linux_xfrm_mib)) < 0) | ||
2790 | return -ENOMEM; | 2788 | return -ENOMEM; |
2791 | rv = xfrm_proc_init(net); | 2789 | rv = xfrm_proc_init(net); |
2792 | if (rv < 0) | 2790 | if (rv < 0) |
2793 | snmp_mib_free((void __percpu **)net->mib.xfrm_statistics); | 2791 | free_percpu(net->mib.xfrm_statistics); |
2794 | return rv; | 2792 | return rv; |
2795 | } | 2793 | } |
2796 | 2794 | ||
2797 | static void xfrm_statistics_fini(struct net *net) | 2795 | static void xfrm_statistics_fini(struct net *net) |
2798 | { | 2796 | { |
2799 | xfrm_proc_fini(net); | 2797 | xfrm_proc_fini(net); |
2800 | snmp_mib_free((void __percpu **)net->mib.xfrm_statistics); | 2798 | free_percpu(net->mib.xfrm_statistics); |
2801 | } | 2799 | } |
2802 | #else | 2800 | #else |
2803 | static int __net_init xfrm_statistics_init(struct net *net) | 2801 | static int __net_init xfrm_statistics_init(struct net *net) |
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c index fc5abd0b456f..9c4fbd8935f4 100644 --- a/net/xfrm/xfrm_proc.c +++ b/net/xfrm/xfrm_proc.c | |||
@@ -54,8 +54,7 @@ static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) | |||
54 | int i; | 54 | int i; |
55 | for (i = 0; xfrm_mib_list[i].name; i++) | 55 | for (i = 0; xfrm_mib_list[i].name; i++) |
56 | seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, | 56 | seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, |
57 | snmp_fold_field((void __percpu **) | 57 | snmp_fold_field(net->mib.xfrm_statistics, |
58 | net->mib.xfrm_statistics, | ||
59 | xfrm_mib_list[i].entry)); | 58 | xfrm_mib_list[i].entry)); |
60 | return 0; | 59 | return 0; |
61 | } | 60 | } |