linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx
@ 2017-03-30  5:20 Minchan Kim
  2017-03-30 14:02 ` Sagi Grimberg
  2017-03-30 14:12 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Minchan Kim @ 2017-03-30  5:20 UTC (permalink / raw)
  To: Jens Axboe
  Cc: kernel-team, linux-block, linux-kernel, Minchan Kim,
	Sagi Grimberg, Omar Sandoval

In blk_mq_alloc_request_hctx, blk_mq_sched_get_request doesn't
get sw context so we don't need to put the context with
blk_mq_put_ctx. Unless, we will see preempt counter underflow.

Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Jens Axboe <axboe@fb.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---

Maybe, it would be fixed by someone but I have noticed preempt counter
undeflow problem a few weeks ago and still see the problem with
linux-next.

 block/blk-mq.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index a4546f060e80..a6f3998dc4ee 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -321,7 +321,6 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, int rw,
 
 	rq = blk_mq_sched_get_request(q, NULL, rw, &alloc_data);
 
-	blk_mq_put_ctx(alloc_data.ctx);
 	blk_queue_exit(q);
 
 	if (!rq)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx
  2017-03-30  5:20 [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx Minchan Kim
@ 2017-03-30 14:02 ` Sagi Grimberg
  2017-03-30 14:12 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2017-03-30 14:02 UTC (permalink / raw)
  To: Minchan Kim, Jens Axboe
  Cc: kernel-team, linux-block, linux-kernel, Omar Sandoval

Looks good,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx
  2017-03-30  5:20 [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx Minchan Kim
  2017-03-30 14:02 ` Sagi Grimberg
@ 2017-03-30 14:12 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-03-30 14:12 UTC (permalink / raw)
  To: Minchan Kim
  Cc: kernel-team, linux-block, linux-kernel, Sagi Grimberg, Omar Sandoval

On 03/29/2017 11:20 PM, Minchan Kim wrote:
> In blk_mq_alloc_request_hctx, blk_mq_sched_get_request doesn't
> get sw context so we don't need to put the context with
> blk_mq_put_ctx. Unless, we will see preempt counter underflow.

Good catch, that's definitely a bug. I have applied your patch
for 4.11.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-30 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30  5:20 [PATCH] block: do not put mq context in blk_mq_alloc_request_hctx Minchan Kim
2017-03-30 14:02 ` Sagi Grimberg
2017-03-30 14:12 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).