public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Deadlock in 2.2 sock_alloc_send_skb?
@ 2001-05-10 12:34 Ulrich.Weigand
  2001-05-10 12:57 ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich.Weigand @ 2001-05-10 12:34 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel, schwidefsky



Hi Alan,

we've experienced deadlocks that appear to be caused by the loop in
sock_alloc_send_skb().  To trigger this, you need to combine heavy
network load with memory pressure.  In this situation, sock_wmalloc()
can fail because it really can't allocate any more memory, even though
the send buffer limit for this socket is not yet exhausted.

If that happens, and the socket uses GFP_ATOMIC allocation, the while (1)
loop in sock_alloc_send_skb() will endlessly spin, without ever calling
schedule(), and all the time holding the kernel lock ...

Do you agree that this is a problem?  What do you think about this fix:

diff -ur linux-2.2.19/net/core/sock.c linux-2.2.19-s390/net/core/sock.c
--- linux-2.2.19/net/core/sock.c   Sun Mar 25 18:37:41 2001
+++ linux-2.2.19-s390/net/core/sock.c    Thu May 10 14:02:11 2001
@@ -752,9 +752,11 @@
                    break;
               try_size = fallback;
          }
-         skb = sock_wmalloc(sk, try_size, 0, sk->allocation);
+         skb = sock_wmalloc_err(sk, try_size, 0, sk->allocation, &err);
          if (skb)
               break;
+         if (err)
+              goto failure;

          /*
           *   This means we have too many buffers for this socket already.


Test case is simple:  keep spawning lots of long-running 'ping' processes
until physical memory is exhausted.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-05-11  8:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-10 12:34 Deadlock in 2.2 sock_alloc_send_skb? Ulrich.Weigand
2001-05-10 12:57 ` Alan Cox
2001-05-10 17:30   ` Andi Kleen
2001-05-10 21:13     ` Andrea Arcangeli
2001-05-10 21:17       ` Andi Kleen
2001-05-10 21:32         ` Andrea Arcangeli
2001-05-11  8:36           ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox