mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: vgoyal@redhat.com, jgarzik@pobox.com, davem@davemloft.net,
	hch@infradead.org, ctalbott@google.com, rni@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] block: allow blk_execute_rq_nowait() to be called from IRQ context
Date: Wed, 26 Oct 2011 12:21:10 -0700	[thread overview]
Message-ID: <20111026192110.GA24261@google.com> (raw)
In-Reply-To: <4EA7C094.8000204@kernel.dk>

Hey, Jens.

On Wed, Oct 26, 2011 at 10:11:00AM +0200, Jens Axboe wrote:
> On 2011-10-26 03:02, Tejun Heo wrote:
> > Currently blk_execute_rq_nowait() directly calls __blk_run_queue() and
> > thus must be called from sleepable context.  This patch updates the
> > function such that it can be called from non-sleepable context and
> > schedules async execution in such cases.  This will be used to
> > unexport elv_add_request().
> > 
> > While at it, add FIXME comment for REQ_TYPE_PM_RESUME special case.
> > 
> > -v2: hch pointed out that blk_execute_rq_nowait() can be hot path for
> >      some drivers.  Retained direct execution from sleepable context.
> 
> Ugh, this looks nasty:
> 
> > +	bool may_sleep = !preempt_count() && !irqs_disabled();
> 
> please don't ever do that. Pass the context in instead.

Hmmm... I don't know.  This is strictly for optimization in block
layer proper.  It's kinda nasty to expose that, especially when the
interface is named _nowait and we already have separate request
allocation API.  Let's leave this alone for now.  The only offending
driver is ide anyway.

> > +	/*
> > +	 * Some drivers beat this path pretty hard.  As an optimization, if
> > +	 * we're being called from sleepable context, run @q directly.
> > +	 */
> > +	if (may_sleep) {
> > +		__blk_run_queue(q);
> > +		/*
> > +		 * The queue is stopped so it won't be run.
> > +		 * FIXME: Please kill me along with REQ_TYPE_PM_RESUME.
> > +		 */
> > +		if (rq->cmd_type == REQ_TYPE_PM_RESUME)
> > +			q->request_fn(q);
> 
> This is very nasty as well.

That's what the current code has.  We really need to take out those
odd request types.

Thanks.

-- 
tejun

  reply	other threads:[~2011-10-26 19:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26  1:02 [PATCHSET block:for-3.2/core] further updates to blk_cleanup_queue(), take#2 Tejun Heo
2011-10-26  1:02 ` [PATCH 1/6] block, sx8: kill blk_insert_request() Tejun Heo
2011-10-26  1:19   ` Jeff Garzik
2011-10-26  8:12   ` Jens Axboe
2011-10-26  1:02 ` [PATCH 2/6] block: allow blk_execute_rq_nowait() to be called from IRQ context Tejun Heo
2011-10-26  8:11   ` Jens Axboe
2011-10-26 19:21     ` Tejun Heo [this message]
2011-10-26  1:02 ` [PATCH 3/6] block, ide: unexport elv_add_request() Tejun Heo
2011-10-26  1:02 ` [PATCH 4/6] block: add blk_queue_dead() Tejun Heo
2011-10-26  8:18   ` Jens Axboe
2011-10-26 17:20   ` Vivek Goyal
2011-10-26 19:25     ` Tejun Heo
2011-10-26  1:02 ` [PATCH 5/6] block: fix drain_all condition in blk_drain_queue() Tejun Heo
2011-10-26  1:02 ` [PATCH 6/6] block: add missing blk_queue_dead() checks Tejun Heo

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=20111026192110.GA24261@google.com \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=ctalbott@google.com \
    --cc=davem@davemloft.net \
    --cc=hch@infradead.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rni@google.com \
    --cc=vgoyal@redhat.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

Powered by JetHome