Re: inconsistent lock/deadlock crash, vanilla 3.3.4, 32bit, tcp

From: Denys Fedoryshchenko
Date: Sun Apr 29 2012 - 04:46:12 EST


On 2012-04-29 11:27, Eric Dumazet wrote:


OK, so when we have memory pressure we can call
percpu_counter_read_positive() with SOFTIRQ enabled, and lockdep
complains...

This bug was probably added in 2008, in commit 1748376b6626a
(net: Use a percpu_counter for sockets_allocated)

I'll have to backport the following patch, can you test it please ?

Thanks !

net/core/sock.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/core/sock.c b/net/core/sock.c
index b2e14c0..08fc929 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1818,7 +1818,9 @@ int __sk_mem_schedule(struct sock *sk, int
size, int kind)

if (!sk_under_memory_pressure(sk))
return 1;
+ local_bh_disable();
alloc = sk_sockets_allocated_read_positive(sk);
+ local_bh_enable();
if (sk_prot_mem_limits(sk, 2) > alloc *
sk_mem_pages(sk->sk_wmem_queued +
atomic_read(&sk->sk_rmem_alloc) +

I will try to deploy it and test as soon as someone will powercycle server on other side.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/