linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V3 3/3] blk-mq: fix dispatch from sw queue
Date: Mon, 17 Dec 2018 08:43:45 -0700	[thread overview]
Message-ID: <9cfcc95b-883e-db62-1ae1-3c98b8f4048f@kernel.dk> (raw)
In-Reply-To: <65b5ae24-2c02-7f78-275e-3df5a860cad5@kernel.dk>

On 12/17/18 6:29 AM, Jens Axboe wrote:
> On 12/17/18 5:55 AM, Jens Axboe wrote:
>> On 12/17/18 5:08 AM, Ming Lei wrote:
>>> When requst is added to rq list of sw queue(ctx), the rq may be from
>>> different type of hctx, especially after multi queue mapping is introduced.
>>>
>>> So when dispach request from sw queue via blk_mq_flush_busy_ctxs() or
>>> blk_mq_dequeue_from_ctx(), one request belonging to other queue type of
>>> hctx can be dispatch to current hctx in case that read queue or poll queue
>>> is enabled.
>>>
>>> This patch fixes this issue by introducing per-queue-type list.
>>
>> Looks good, just one comment:
>>
>>> diff --git a/block/blk-mq.h b/block/blk-mq.h
>>> index d1ed096723fb..0973a91eb1dd 100644
>>> --- a/block/blk-mq.h
>>> +++ b/block/blk-mq.h
>>> @@ -12,14 +12,16 @@ struct blk_mq_ctxs {
>>>  	struct blk_mq_ctx __percpu	*queue_ctx;
>>>  };
>>>  
>>> +struct blk_mq_ctx_list {
>>> +	spinlock_t		lock;
>>> +	struct list_head	rq_list;
>>> +}  ____cacheline_aligned_in_smp;
>>> +
>>>  /**
>>>   * struct blk_mq_ctx - State for a software queue facing the submitting CPUs
>>>   */
>>>  struct blk_mq_ctx {
>>> -	struct {
>>> -		spinlock_t		lock;
>>> -		struct list_head	rq_list;
>>> -	}  ____cacheline_aligned_in_smp;
>>> +	struct blk_mq_ctx_list  list[HCTX_MAX_TYPES];
>>
>> Let's not make that use 3 cachelines. There is no good reason to split
>> these across cachelines, if we have heavy traffic to multiple of these,
>> then we're not going very fast anyway. So just make it:
>>
>> 	struct {
>> 		spinlock_t		lock;
>> 		struct list_head	rq_list[HCTX_MAX_TYPES];
>> 	}  ____cacheline_aligned_in_smp;
> 
> Did it just to check, turns out fine and is of course less changes.
> Let me know.

Tests good for me, thanks for doing this work. Just a heads up that
I'm going to queue this up, attributed to you, but just with a note
that I changed the layout of that structure.

-- 
Jens Axboe


  reply	other threads:[~2018-12-17 15:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 12:08 [PATCH V3 0/4] blk-mq: queue mapping fix & improvement Ming Lei
2018-12-17 12:08 ` [PATCH V3 1/3] blk-mq: fix allocation for queue mapping table Ming Lei
2018-12-17 12:08 ` [PATCH V3 2/3] blk-mq: export hctx->type in debugfs instead of sysfs Ming Lei
2018-12-17 12:08 ` [PATCH V3 3/3] blk-mq: fix dispatch from sw queue Ming Lei
2018-12-17 12:55   ` Jens Axboe
2018-12-17 13:29     ` Jens Axboe
2018-12-17 15:43       ` Jens Axboe [this message]
2018-12-17 12:56 ` [PATCH V3 0/4] blk-mq: queue mapping fix & improvement 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=9cfcc95b-883e-db62-1ae1-3c98b8f4048f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@lst.de \
    --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;
as well as URLs for NNTP newsgroup(s).