public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Jesper Juhl <jesper.juhl@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: Simple script that locks up my box with recent kernels
Date: Wed, 22 Nov 2006 09:03:13 +0100	[thread overview]
Message-ID: <20061122080312.GL8055@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.64.0611211827590.3338@woody.osdl.org>

On Tue, Nov 21 2006, Linus Torvalds wrote:
> I don't think we use any irq-disable locking in the VM itself, but I could 
> imagine some nasty situation with the block device layer getting into a 
> deadlock with interrupts disabled when it runs out of queue entries and 
> cannot allocate more memory..

Not likely. Request allocation is done with GFP_NOIO and backed by a
memory pool, so as long the vm doesn't go totally nuts because
__GFP_WAIT is set, we should be safe there. If it did go crazy, I
suspect a sysrq-t would still work.

If bouncing is involved for swap, we do have a potential deadlock issue
that isn't fixed yet. I just whipped up this completely untested patch,
it should shed some light on that issue.

diff --git a/mm/bounce.c b/mm/bounce.c
index e4b62d2..f75eb37 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -20,6 +20,7 @@ #define POOL_SIZE	64
 #define ISA_POOL_SIZE	16
 
 static mempool_t *page_pool, *isa_page_pool;
+static struct bio_set *bounce_bio_set;
 
 #ifdef CONFIG_HIGHMEM
 static __init int init_emergency_pool(void)
@@ -31,6 +32,9 @@ static __init int init_emergency_pool(vo
 	if (!i.totalhigh)
 		return 0;
 
+	bounce_bio_set = bioset_create(1, 1, 0);
+	BUG_ON(!bounce_bio_set);
+
 	page_pool = mempool_create_page_pool(POOL_SIZE, 0);
 	BUG_ON(!page_pool);
 	printk("highmem bounce pool size: %d pages\n", POOL_SIZE);
@@ -190,6 +194,11 @@ static int bounce_end_io_read_isa(struct
 	return 0;
 }
 
+static void bounce_bio_destructor(struct bio *bio)
+{
+	bio_free(bio, bounce_bio_set);
+}
+
 static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig,
 			       mempool_t *pool)
 {
@@ -210,8 +219,10 @@ static void __blk_queue_bounce(request_q
 		/*
 		 * irk, bounce it
 		 */
-		if (!bio)
-			bio = bio_alloc(GFP_NOIO, (*bio_orig)->bi_vcnt);
+		if (!bio) {
+			bio = bio_alloc_bioset(GFP_NOIO, (*bio_orig)->bi_vcnt, bounce_bio_set);
+			bio->bi_destructor = bounce_bio_destructor;
+		}
 
 		to = bio->bi_io_vec + i;
 

-- 
Jens Axboe


  parent reply	other threads:[~2006-11-22  8:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06 23:36 Simple script that locks up my box with recent kernels Jesper Juhl
2006-10-06 23:54 ` Andrew Morton
2006-10-07  0:06   ` Jesper Juhl
2006-10-07  0:21     ` Jesper Juhl
2006-10-07  3:11 ` Linus Torvalds
2006-10-07 21:02   ` Jesper Juhl
2006-10-07 21:25     ` Linus Torvalds
2006-10-08 23:33       ` Jesper Juhl
2006-10-16 22:45         ` Jesper Juhl
2006-10-16 23:04           ` Linus Torvalds
2006-10-16 23:13             ` Jesper Juhl
2006-10-23 20:30               ` Jesper Juhl
2006-11-22  0:46                 ` Jesper Juhl
2006-11-22  2:36                   ` Linus Torvalds
2006-11-22  3:25                     ` Dave Jones
2006-11-22  3:44                       ` Linus Torvalds
2006-11-22  3:49                         ` Dave Jones
2006-11-22 10:32                           ` Pádraig Brady
2006-11-22 17:58                             ` Dave Jones
2006-11-22  8:03                     ` Jens Axboe [this message]
2006-11-22 10:55                       ` Jesper Juhl
2006-11-22 10:57                         ` Jens Axboe
2006-11-22 11:04                           ` Jesper Juhl
2006-11-22 11:07                             ` Jens Axboe
2006-11-23 23:52                               ` Jesper Juhl
2006-11-24  6:52                                 ` Jens Axboe
2006-11-24  9:41                                   ` Jesper Juhl
2006-11-24  9:46                                     ` Jens Axboe
2006-11-24  9:52                                       ` Jesper Juhl
2006-11-23 10:22                             ` Jesper Juhl
2006-11-23 23:48                           ` Jesper Juhl
2006-11-22 11:00                     ` Jesper Juhl
2006-11-24  0:50                     ` Jesper Juhl
2006-10-07  3:40 ` Grant Coady

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=20061122080312.GL8055@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@osdl.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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