From: Jens Axboe <axboe@kernel.dk>
To: 胡海 <huhai@kylinos.cn>
Cc: "ming.lei" <ming.lei@redhat.com>,
linux-block <linux-block@vger.kernel.org>
Subject: Re: blk-mq: make sure that correct hctx->dispatch_from is set
Date: Fri, 18 May 2018 08:31:31 -0600 [thread overview]
Message-ID: <07c44734-2aeb-79b2-6404-893b575debd5@kernel.dk> (raw)
In-Reply-To: <6c265e65-d248-f6e0-1be4-e4223f1a4ed6@kernel.dk>
On 5/18/18 8:27 AM, Jens Axboe wrote:
> On 5/18/18 7:42 AM, 胡海 wrote:
>> Author: huhai <huhai@kylinos.cn>
>> Date: Fri May 18 17:09:56 2018 +0800
>>
>> blk-mq: make sure that correct hctx->dispatch_from is set
>>
>> When the number of hardware queues is changed, the drivers will call
>> blk_mq_update_nr_hw_queues() to remap hardware queues, and then
>> the ctx mapped on hctx will also change, but the current code forgets to
>> make sure that correct hctx->dispatch_from is set, and hctx->dispatch_from
>> may point to a ctx that does not belong to the current hctx.
>
> Looks good, thanks. One minor note for future patches - for cases like this,
> when the patch fixes an issue with a specific commit, add a fixes line.
> For this one, it would be:
>
> Fixes: b347689ffbca ("blk-mq-sched: improve dispatching from sw queue")
Two more notes... Your patches are still coming through as base64 encoded,
they should just be plain text.
Finally, I think the below is much clearer, since that's the loop where
we clear any existing hctx context.
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6c6aef44badd..4cbfd784e837 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2358,6 +2358,7 @@ static void blk_mq_map_swqueue(struct request_queue *q)
queue_for_each_hw_ctx(q, hctx, i) {
cpumask_clear(hctx->cpumask);
hctx->nr_ctx = 0;
+ hctx->dispatch_from = NULL;
}
/*
--
Jens Axboe
next prev parent reply other threads:[~2018-05-18 14:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 13:42 blk-mq: make sure that correct hctx->dispatch_from is set 胡海
2018-05-18 14:00 ` Ming Lei
2018-05-18 14:27 ` Jens Axboe
2018-05-18 14:31 ` Jens Axboe [this message]
2018-05-18 14:46 ` huhai
2018-05-18 14:50 ` Jens Axboe
2018-05-18 15:10 ` Bart Van Assche
2018-05-18 15:15 ` Jens Axboe
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=07c44734-2aeb-79b2-6404-893b575debd5@kernel.dk \
--to=axboe@kernel.dk \
--cc=huhai@kylinos.cn \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@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