All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: arjan@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: blk_queue_bounce_limits can actually sleep
Date: Tue, 20 May 2008 12:45:56 -0700	[thread overview]
Message-ID: <20080520124556.ad0c3fca.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080520192958.GW22369@kernel.dk>

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

> On Mon, May 19 2008, Arjan van de Ven wrote:
> > From: Arjan van de Ven <arjan@linux.intel.com>
> > Subject: [PATCH] block: blk_queue_bounce_limits can actually sleep
> > 
> > blk_queue_bounce_limit can call init_emergency_isa_pool, which
> > does sleeping allocations... document it as such by adding
> > might_sleep() to the driver
> 
> Isn't that superflous, as mempool_create() -> kmalloc(..., __GFP_WAIT)
> ends up spewing that warning anyway?

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???

  reply	other threads:[~2008-05-20 19:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20  3:24 [PATCH] block: blk_queue_bounce_limits can actually sleep Arjan van de Ven
2008-05-20 19:29 ` Jens Axboe
2008-05-20 19:45   ` Andrew Morton [this message]
2008-05-20 19:58     ` Jens Axboe
2008-05-20 21:02       ` Arjan van de Ven
2008-05-20 20:03     ` Arjan van de Ven

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=20080520124556.ad0c3fca.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.