diff options
author | Eric Dumazet <edumazet@google.com> | 2017-01-20 08:06:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-20 11:27:22 -0500 |
commit | c2a2efbbfcb31bedcf81170fc1aa920255c33b8f (patch) | |
tree | 0feeac1e086d1179ce3bce1482d5cd27653aa33a | |
parent | 0a327889f64619ac3ec886208644191cd87de525 (diff) |
net: remove bh disabling around percpu_counter accesses
Shaohua Li made percpu_counter irq safe in commit 098faf5805c8
("percpu_counter: make APIs irq safe")
We can safely remove BH disable/enable sections around various
percpu_counter manipulations.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/dst_ops.h | 9 | ||||
-rw-r--r-- | include/net/inet_frag.h | 8 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 3 | ||||
-rw-r--r-- | net/ipv4/proc.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 |
6 files changed, 3 insertions, 23 deletions
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index a0d443ca16fc..8a2b66d8d78d 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
@@ -46,19 +46,12 @@ static inline int dst_entries_get_fast(struct dst_ops *dst) | |||
46 | 46 | ||
47 | static inline int dst_entries_get_slow(struct dst_ops *dst) | 47 | static inline int dst_entries_get_slow(struct dst_ops *dst) |
48 | { | 48 | { |
49 | int res; | 49 | return percpu_counter_sum_positive(&dst->pcpuc_entries); |
50 | |||
51 | local_bh_disable(); | ||
52 | res = percpu_counter_sum_positive(&dst->pcpuc_entries); | ||
53 | local_bh_enable(); | ||
54 | return res; | ||
55 | } | 50 | } |
56 | 51 | ||
57 | static inline void dst_entries_add(struct dst_ops *dst, int val) | 52 | static inline void dst_entries_add(struct dst_ops *dst, int val) |
58 | { | 53 | { |
59 | local_bh_disable(); | ||
60 | percpu_counter_add(&dst->pcpuc_entries, val); | 54 | percpu_counter_add(&dst->pcpuc_entries, val); |
61 | local_bh_enable(); | ||
62 | } | 55 | } |
63 | 56 | ||
64 | static inline int dst_entries_init(struct dst_ops *dst) | 57 | static inline int dst_entries_init(struct dst_ops *dst) |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 909972aa3acd..5894730ec82a 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -164,13 +164,7 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i) | |||
164 | 164 | ||
165 | static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) | 165 | static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) |
166 | { | 166 | { |
167 | unsigned int res; | 167 | return percpu_counter_sum_positive(&nf->mem); |
168 | |||
169 | local_bh_disable(); | ||
170 | res = percpu_counter_sum_positive(&nf->mem); | ||
171 | local_bh_enable(); | ||
172 | |||
173 | return res; | ||
174 | } | 168 | } |
175 | 169 | ||
176 | /* RFC 3168 support : | 170 | /* RFC 3168 support : |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 096a085611ab..c7f7c5335369 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -836,9 +836,8 @@ void inet_csk_destroy_sock(struct sock *sk) | |||
836 | 836 | ||
837 | sk_refcnt_debug_release(sk); | 837 | sk_refcnt_debug_release(sk); |
838 | 838 | ||
839 | local_bh_disable(); | ||
840 | percpu_counter_dec(sk->sk_prot->orphan_count); | 839 | percpu_counter_dec(sk->sk_prot->orphan_count); |
841 | local_bh_enable(); | 840 | |
842 | sock_put(sk); | 841 | sock_put(sk); |
843 | } | 842 | } |
844 | EXPORT_SYMBOL(inet_csk_destroy_sock); | 843 | EXPORT_SYMBOL(inet_csk_destroy_sock); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 0247ca032232..a9deeb90dd36 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -57,10 +57,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) | |||
57 | unsigned int frag_mem; | 57 | unsigned int frag_mem; |
58 | int orphans, sockets; | 58 | int orphans, sockets; |
59 | 59 | ||
60 | local_bh_disable(); | ||
61 | orphans = percpu_counter_sum_positive(&tcp_orphan_count); | 60 | orphans = percpu_counter_sum_positive(&tcp_orphan_count); |
62 | sockets = proto_sockets_allocated_sum_positive(&tcp_prot); | 61 | sockets = proto_sockets_allocated_sum_positive(&tcp_prot); |
63 | local_bh_enable(); | ||
64 | 62 | ||
65 | socket_seq_show(seq); | 63 | socket_seq_show(seq); |
66 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n", | 64 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n", |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index aba6ea76338e..c43eb1a831d7 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -420,9 +420,7 @@ void tcp_init_sock(struct sock *sk) | |||
420 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; | 420 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; |
421 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; | 421 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; |
422 | 422 | ||
423 | local_bh_disable(); | ||
424 | sk_sockets_allocated_inc(sk); | 423 | sk_sockets_allocated_inc(sk); |
425 | local_bh_enable(); | ||
426 | } | 424 | } |
427 | EXPORT_SYMBOL(tcp_init_sock); | 425 | EXPORT_SYMBOL(tcp_init_sock); |
428 | 426 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 3644fc117691..f7325b25b06e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1887,9 +1887,7 @@ void tcp_v4_destroy_sock(struct sock *sk) | |||
1887 | tcp_free_fastopen_req(tp); | 1887 | tcp_free_fastopen_req(tp); |
1888 | tcp_saved_syn_free(tp); | 1888 | tcp_saved_syn_free(tp); |
1889 | 1889 | ||
1890 | local_bh_disable(); | ||
1891 | sk_sockets_allocated_dec(sk); | 1890 | sk_sockets_allocated_dec(sk); |
1892 | local_bh_enable(); | ||
1893 | } | 1891 | } |
1894 | EXPORT_SYMBOL(tcp_v4_destroy_sock); | 1892 | EXPORT_SYMBOL(tcp_v4_destroy_sock); |
1895 | 1893 | ||