Re: [PATCH] block: blk_queue_bounce_limits can actually sleep

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Tuesday, May 20, 2008 - 12:45 pm

On Tue, 20 May 2008 21:29:59 +0200
Jens Axboe <jens.axboe@oracle.com> wrote:


It's largely superfluous given the way in which Arjan implemented it.

One situation which we regularly hit is:

foo()
{
	...
	if (some_unlikely_condition())
		do_something_which_sleeps();
	...
}

and then we go and call that code under spinlock and ship it out, when
of course a handful of testers hit the unlikely condition.

The solution to that is to add a might_sleep() _outside_ the test of
some_unlikely_condition().  ie:

--- a/block/blk-settings.c~a
+++ a/block/blk-settings.c
@@ -140,6 +140,8 @@ void blk_queue_bounce_limit(struct reque
 	unsigned long b_pfn = dma_addr >> PAGE_SHIFT;
 	int dma = 0;
 
+	might_sleep();
+
 	q->bounce_gfp = GFP_NOIO;
 #if BITS_PER_LONG == 64
 	/* Assume anything <= 4GB can be handled by IOMMU.
_

but it's all vague and waffly because Arjan forgot to tell us why he's
bothering to patch this code at all???
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] block: blk_queue_bounce_limits can actually sleep, Arjan van de Ven, (Mon May 19, 8:24 pm)
Re: [PATCH] block: blk_queue_bounce_limits can actually sleep, Andrew Morton, (Tue May 20, 12:45 pm)
Re: [PATCH] block: blk_queue_bounce_limits can actually sleep, Arjan van de Ven, (Tue May 20, 1:03 pm)
Re: [PATCH] block: blk_queue_bounce_limits can actually sleep, Arjan van de Ven, (Tue May 20, 2:02 pm)