mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ulrich.Weigand@de.ibm.com
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com
Subject: Deadlock in 2.2 sock_alloc_send_skb?
Date: Thu, 10 May 2001 14:34:46 +0200	[thread overview]
Message-ID: <C1256A48.00451BD1.00@d12mta11.de.ibm.com> (raw)



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



             reply	other threads:[~2001-05-10 12:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-10 12:34 Ulrich.Weigand [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C1256A48.00451BD1.00@d12mta11.de.ibm.com \
    --to=ulrich.weigand@de.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®