* blk-mq: make sure that correct hctx->dispatch_from is set @ 2018-05-18 13:42 胡海 2018-05-18 14:00 ` Ming Lei 2018-05-18 14:27 ` Jens Axboe 0 siblings, 2 replies; 8+ messages in thread From: 胡海 @ 2018-05-18 13:42 UTC (permalink / raw) To: axboe; +Cc: ming.lei, linux-block QXV0aG9yOiBodWhhaSA8aHVoYWlAa3lsaW5vcy5jbj4NCkRhdGU6ICAgRnJpIE1heSAxOCAx NzowOTo1NiAyMDE4ICswODAwDQoNCiAgICBibGstbXE6IG1ha2Ugc3VyZSB0aGF0IGNvcnJl Y3QgaGN0eC0+ZGlzcGF0Y2hfZnJvbSBpcyBzZXQNCiAgICANCiAgICBXaGVuIHRoZSBudW1i ZXIgb2YgaGFyZHdhcmUgcXVldWVzIGlzIGNoYW5nZWQsIHRoZSBkcml2ZXJzIHdpbGwgY2Fs bA0KICAgIGJsa19tcV91cGRhdGVfbnJfaHdfcXVldWVzKCkgdG8gcmVtYXAgaGFyZHdhcmUg cXVldWVzLCBhbmQgdGhlbg0KICAgIHRoZSBjdHggbWFwcGVkIG9uIGhjdHggd2lsbCBhbHNv IGNoYW5nZSwgYnV0IHRoZSBjdXJyZW50IGNvZGUgZm9yZ2V0cyB0bw0KICAgIG1ha2Ugc3Vy ZSB0aGF0IGNvcnJlY3QgaGN0eC0+ZGlzcGF0Y2hfZnJvbSBpcyBzZXQsIGFuZCBoY3R4LT5k aXNwYXRjaF9mcm9tDQogICAgbWF5IHBvaW50IHRvIGEgY3R4IHRoYXQgZG9lcyBub3QgYmVs b25nIHRvIHRoZSBjdXJyZW50IGhjdHguDQogICAgDQogICAgU2lnbmVkLW9mZi1ieTogaHVo YWkgPGh1aGFpQGt5bGlub3MuY24+DQoNCmRpZmYgLS1naXQgYS9ibG9jay9ibGstbXEuYyBi L2Jsb2NrL2Jsay1tcS5jDQppbmRleCAyNTQ1MDgxLi41NWQ4YTNkIDEwMDY0NA0KLS0tIGEv YmxvY2svYmxrLW1xLmMNCisrKyBiL2Jsb2NrL2Jsay1tcS5jDQpAQCAtMjIxNCw2ICsyMjE0 LDggQEAgc3RhdGljIHZvaWQgYmxrX21xX21hcF9zd3F1ZXVlKHN0cnVjdCByZXF1ZXN0X3F1 ZXVlICpxKQ0KICAgICAgICAgICAgICAgIGhjdHgtPnRhZ3MgPSBzZXQtPnRhZ3NbaV07DQog ICAgICAgICAgICAgICAgV0FSTl9PTighaGN0eC0+dGFncyk7DQogDQorICAgICAgICAgICAg ICAgaGN0eC0+ZGlzcGF0Y2hfZnJvbSA9IE5VTEw7DQorDQogICAgICAgICAgICAgICAgLyoN CiAgICAgICAgICAgICAgICAgKiBTZXQgdGhlIG1hcCBzaXplIHRvIHRoZSBudW1iZXIgb2Yg bWFwcGVkIHNvZnR3YXJlIHF1ZXVlcy4NCiAgICAgICAgICAgICAgICAgKiBUaGlzIGlzIG1v cmUgYWNjdXJhdGUgYW5kIG1vcmUgZWZmaWNpZW50IHRoYW4gbG9vcGluZw== ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 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 1 sibling, 0 replies; 8+ messages in thread From: Ming Lei @ 2018-05-18 14:00 UTC (permalink / raw) To: 胡海; +Cc: axboe, ming.lei, linux-block On Fri, May 18, 2018 at 9:42 PM, =E8=83=A1=E6=B5=B7 <huhai@kylinos.cn> wrot= e: > 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. > > Signed-off-by: huhai <huhai@kylinos.cn> > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 2545081..55d8a3d 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -2214,6 +2214,8 @@ static void blk_mq_map_swqueue(struct request_queue= *q) > hctx->tags =3D set->tags[i]; > WARN_ON(!hctx->tags); > > + hctx->dispatch_from =3D NULL; > + > /* > * Set the map size to the number of mapped software queu= es. > * This is more accurate and more efficient than looping Good catch, Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming Lei ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 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 1 sibling, 1 reply; 8+ messages in thread From: Jens Axboe @ 2018-05-18 14:27 UTC (permalink / raw) To: 胡海; +Cc: ming.lei, linux-block 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") -- Jens Axboe ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 2018-05-18 14:27 ` Jens Axboe @ 2018-05-18 14:31 ` Jens Axboe 2018-05-18 14:46 ` huhai 0 siblings, 1 reply; 8+ messages in thread From: Jens Axboe @ 2018-05-18 14:31 UTC (permalink / raw) To: 胡海; +Cc: ming.lei, linux-block 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 2018-05-18 14:31 ` Jens Axboe @ 2018-05-18 14:46 ` huhai 2018-05-18 14:50 ` Jens Axboe 2018-05-18 15:10 ` Bart Van Assche 0 siblings, 2 replies; 8+ messages in thread From: huhai @ 2018-05-18 14:46 UTC (permalink / raw) To: Jens Axboe; +Cc: ming.lei, linux-block WWVzLCBpdCBpcyBtb3JlIHJlYWRhYmxlDQoNCkZpbmFsbHksIHRoYW5rIHlvdSBmb3IgcmVt aW5kaW5nIG1lLiBOZXh0IHRpbWUgSSdsbCBjaGFuZ2UgZ21haWwgdG8gc3VibWl0IHBhdGNo Lg0KDQogDQogDQogDQotLS0tLS0tLS0tLS0tLS0tLS0gT3JpZ2luYWwgLS0tLS0tLS0tLS0t LS0tLS0tDQpGcm9tOiAgIkplb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cXVldWVfZm9yX2VhY2hfaHdfY3R4 KHEsIGhjdHgsIGkpIHsNCiAJY3B1bWFza19jbGVhcihoY3R4LT5jcHVtYXNrKTsNCiAJaGN0 eC0+bnJfY3R4ID0gMDsNCisJaGN0eC0+ZGlzcGF0Y2hfZnJvbSA9IE5VTEw7DQogCX0NCiAN CiAJLyoNCg0KLS0gDQpKZW5zIEF4Ym9l ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 2018-05-18 14:46 ` huhai @ 2018-05-18 14:50 ` Jens Axboe 2018-05-18 15:10 ` Bart Van Assche 1 sibling, 0 replies; 8+ messages in thread From: Jens Axboe @ 2018-05-18 14:50 UTC (permalink / raw) To: huhai; +Cc: ming.lei, linux-block On 5/18/18 8:46 AM, huhai wrote: > Yes, it is more readable Final version: http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.18/block&id=d416c92c5d6229b33f37f0f75e52194081ccbcc4 > Finally, thank you for reminding me. Next time I'll change gmail to submit patch. Not sure gmail can ever really work. You should not top-post reply to postings either. If you want to experiment with getting a mailer setup and whether or not it does the right thing, feel free to send a patch to my email privately, and I can let you know if the end result is as it should be. -- Jens Axboe ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 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 1 sibling, 1 reply; 8+ messages in thread From: Bart Van Assche @ 2018-05-18 15:10 UTC (permalink / raw) To: huhai@kylinos.cn, axboe@kernel.dk Cc: linux-block@vger.kernel.org, ming.lei@redhat.com T24gRnJpLCAyMDE4LTA1LTE4IGF0IDIyOjQ2ICswODAwLCBodWhhaSB3cm90ZToNCj4gWWVzLCBp dCBpcyBtb3JlIHJlYWRhYmxlDQo+IA0KPiBGaW5hbGx5LCB0aGFuayB5b3UgZm9yIHJlbWluZGlu ZyBtZS4gTmV4dCB0aW1lIEknbGwgY2hhbmdlIGdtYWlsIHRvIHN1Ym1pdCBwYXRjaC4NCg0KSGVs bG8gSHVoYWksDQoNClBsZWFzZSBoYXZlIGEgbG9vayBhdCBEb2N1bWVudGF0aW9uL3Byb2Nlc3Mv ZW1haWwtY2xpZW50cy5yc3QuDQoNClRoYW5rcywNCg0KQmFydC4NCg0KDQoNCg0KDQoNCg0KDQo= ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: blk-mq: make sure that correct hctx->dispatch_from is set 2018-05-18 15:10 ` Bart Van Assche @ 2018-05-18 15:15 ` Jens Axboe 0 siblings, 0 replies; 8+ messages in thread From: Jens Axboe @ 2018-05-18 15:15 UTC (permalink / raw) To: Bart Van Assche, huhai@kylinos.cn Cc: linux-block@vger.kernel.org, ming.lei@redhat.com On 5/18/18 9:10 AM, Bart Van Assche wrote: > On Fri, 2018-05-18 at 22:46 +0800, huhai wrote: >> Yes, it is more readable >> >> Finally, thank you for reminding me. Next time I'll change gmail to submit patch. > > Hello Huhai, > > Please have a look at Documentation/process/email-clients.rst. Yeah, I did point at that one too. For sending out patches, I would strongly recommend just using git send-email. It works fine with gmail, that's what I always use. $ cat ~/.gitconfig [sendemail] from = Jens Axboe <axboe@kernel.dk> smtpserver = smtp.gmail.com smtpuser = axboe@kernel.dk smtpencryption = tls smtppass = <insert pass or appcode here> smtpserverport = 587 -- Jens Axboe ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-05-18 15:15 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox