[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EA7C094.8000204@kernel.dk>
Date: Wed, 26 Oct 2011 10:11:00 +0200
From: Jens Axboe <axboe@...nel.dk>
To: Tejun Heo <tj@...nel.org>
CC: vgoyal@...hat.com, jgarzik@...ox.com, davem@...emloft.net,
hch@...radead.org, ctalbott@...gle.com, rni@...gle.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/6] block: allow blk_execute_rq_nowait() to be called
from IRQ context
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.
> + /*
> + * 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.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists