Re: [PATCH 2/2] blk-mq: add flag for drivers wanting blocking ->queue_rq()
flat view
From: Jens Axboe <hidden>
Date: 2016-09-22 15:03:56
On 09/22/2016 08:59 AM, Christoph Hellwig wrote:
On Thu, Sep 22, 2016 at 08:53:00AM -0600, Jens Axboe wrote:quoted
If a driver sets BLK_MQ_F_BLOCKING, it is allowed to block in its ->queue_rq() handler. For that case, blk-mq ensures that we always calls it from a safe context.First can you provide a more useful defintion of blocking? Lots of current drivers will already block in ->queue_rq, mostly to allocate memory.
Having to grab a mutex, for instance. We invoke ->queue_rq() with preemption disabled, so I'd hope that would not be the case... What drivers block in ->queue_rq?
Second we looked at something similar a few times ago, mosty notably when converting loop and rbd, and came to the conclusion that performance sucks when we only have that single per-hctx work struct for a busy device. I think Ming has done a lot of the benchmarking, so I've added him to Cc.
Loop was another case that was on my radar to get rid of the queue_work it currently has to do. Josef is currently testing the nbd driver using this approach, so we should get some numbers there too. If we have to, we can always bump up the concurrency to mimic more of the behavior of having multiple workers running on the hardware queue. I'd prefer to still do that in blk-mq, instead of having drivers reinventing their own work offload functionality. -- Jens Axboe