Commit c2a2efbb authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: remove bh disabling around percpu_counter accesses

Shaohua Li made percpu_counter irq safe in commit 098faf58
("percpu_counter: make APIs irq safe")

We can safely remove BH disable/enable sections around various
percpu_counter manipulations.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a327889
...@@ -46,19 +46,12 @@ static inline int dst_entries_get_fast(struct dst_ops *dst) ...@@ -46,19 +46,12 @@ static inline int dst_entries_get_fast(struct dst_ops *dst)
static inline int dst_entries_get_slow(struct dst_ops *dst) static inline int dst_entries_get_slow(struct dst_ops *dst)
{ {
int res; return percpu_counter_sum_positive(&dst->pcpuc_entries);
local_bh_disable();
res = percpu_counter_sum_positive(&dst->pcpuc_entries);
local_bh_enable();
return res;
} }
static inline void dst_entries_add(struct dst_ops *dst, int val) static inline void dst_entries_add(struct dst_ops *dst, int val)
{ {
local_bh_disable();
percpu_counter_add(&dst->pcpuc_entries, val); percpu_counter_add(&dst->pcpuc_entries, val);
local_bh_enable();
} }
static inline int dst_entries_init(struct dst_ops *dst) static inline int dst_entries_init(struct dst_ops *dst)
......
...@@ -164,13 +164,7 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i) ...@@ -164,13 +164,7 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
{ {
unsigned int res; return percpu_counter_sum_positive(&nf->mem);
local_bh_disable();
res = percpu_counter_sum_positive(&nf->mem);
local_bh_enable();
return res;
} }
/* RFC 3168 support : /* RFC 3168 support :
......
...@@ -836,9 +836,8 @@ void inet_csk_destroy_sock(struct sock *sk) ...@@ -836,9 +836,8 @@ void inet_csk_destroy_sock(struct sock *sk)
sk_refcnt_debug_release(sk); sk_refcnt_debug_release(sk);
local_bh_disable();
percpu_counter_dec(sk->sk_prot->orphan_count); percpu_counter_dec(sk->sk_prot->orphan_count);
local_bh_enable();
sock_put(sk); sock_put(sk);
} }
EXPORT_SYMBOL(inet_csk_destroy_sock); EXPORT_SYMBOL(inet_csk_destroy_sock);
......
...@@ -57,10 +57,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) ...@@ -57,10 +57,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
unsigned int frag_mem; unsigned int frag_mem;
int orphans, sockets; int orphans, sockets;
local_bh_disable();
orphans = percpu_counter_sum_positive(&tcp_orphan_count); orphans = percpu_counter_sum_positive(&tcp_orphan_count);
sockets = proto_sockets_allocated_sum_positive(&tcp_prot); sockets = proto_sockets_allocated_sum_positive(&tcp_prot);
local_bh_enable();
socket_seq_show(seq); socket_seq_show(seq);
seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n", seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n",
......
...@@ -420,9 +420,7 @@ void tcp_init_sock(struct sock *sk) ...@@ -420,9 +420,7 @@ void tcp_init_sock(struct sock *sk)
sk->sk_sndbuf = sysctl_tcp_wmem[1]; sk->sk_sndbuf = sysctl_tcp_wmem[1];
sk->sk_rcvbuf = sysctl_tcp_rmem[1]; sk->sk_rcvbuf = sysctl_tcp_rmem[1];
local_bh_disable();
sk_sockets_allocated_inc(sk); sk_sockets_allocated_inc(sk);
local_bh_enable();
} }
EXPORT_SYMBOL(tcp_init_sock); EXPORT_SYMBOL(tcp_init_sock);
......
...@@ -1887,9 +1887,7 @@ void tcp_v4_destroy_sock(struct sock *sk) ...@@ -1887,9 +1887,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
tcp_free_fastopen_req(tp); tcp_free_fastopen_req(tp);
tcp_saved_syn_free(tp); tcp_saved_syn_free(tp);
local_bh_disable();
sk_sockets_allocated_dec(sk); sk_sockets_allocated_dec(sk);
local_bh_enable();
} }
EXPORT_SYMBOL(tcp_v4_destroy_sock); EXPORT_SYMBOL(tcp_v4_destroy_sock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment