linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, Hannes Reinecke <hare@suse.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/5] blk-mq: add helper of blk_mq_get_hw_queue_node
Date: Tue, 25 Aug 2020 09:55:47 +0100	[thread overview]
Message-ID: <f9b37b2e-2e18-99ea-ed3f-b5c857338694@huawei.com> (raw)
In-Reply-To: <20200820180335.3109216-3-ming.lei@redhat.com>

On 20/08/2020 19:03, Ming Lei wrote:
> Add helper of blk_mq_get_hw_queue_node for retrieve hw queue's numa
> node.
> 
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Cc: John Garry <john.garry@huawei.com>
> Cc: Christoph Hellwig <hch@lst.de>
> ---
>   block/blk-mq.c | 24 ++++++++++++++----------
>   1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index f9da2d803c18..5019d21e7ff8 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -2263,6 +2263,18 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)
>   }
>   EXPORT_SYMBOL_GPL(blk_mq_submit_bio); /* only for request based dm */
>   
> +static int blk_mq_get_hw_queue_node(struct blk_mq_tag_set *set,
> +		unsigned int hctx_idx)
> +{
> +	int node = blk_mq_hw_queue_to_node(&set->map[HCTX_TYPE_DEFAULT],
> +			hctx_idx);

Hi Ming,

Did you consider if we can consolidate all of this to 
blk_mq_hw_queue_to_node(), by passing the set there also (since we 
always use HCTX_TYPE_DEFAULT)? Or is that just exceeding remit of 
blk_mq_hw_queue_to_node()?

I don't think it would affect the other user of 
blk_mq_hw_queue_to_node(), being blk_mq_realloc_hw_ctxs().

But current change looks ok also.

Thanks

> +
> +	if (node == NUMA_NO_NODE)
> +		node = set->numa_node;
> +
> +	return node;
> +}
> +
>   void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
>   		     unsigned int hctx_idx)
>   {
> @@ -2309,11 +2321,7 @@ struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set,
>   					unsigned int reserved_tags)
>   {
>   	struct blk_mq_tags *tags;
> -	int node;
> -
> -	node = blk_mq_hw_queue_to_node(&set->map[HCTX_TYPE_DEFAULT], hctx_idx);
> -	if (node == NUMA_NO_NODE)
> -		node = set->numa_node;
> +	int node = blk_mq_get_hw_queue_node(set, hctx_idx);
>   
>   	tags = blk_mq_init_tags(nr_tags, reserved_tags, node,
>   				BLK_MQ_FLAG_TO_ALLOC_POLICY(set->flags));
> @@ -2367,11 +2375,7 @@ int blk_mq_alloc_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
>   {
>   	unsigned int i, j, entries_per_page;
>   	size_t rq_size, left;
> -	int node;
> -
> -	node = blk_mq_hw_queue_to_node(&set->map[HCTX_TYPE_DEFAULT], hctx_idx);
> -	if (node == NUMA_NO_NODE)
> -		node = set->numa_node;
> +	int node = blk_mq_get_hw_queue_node(set, hctx_idx);
>   
>   	INIT_LIST_HEAD(&tags->page_list);
>   
> 


  reply	other threads:[~2020-08-25  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 18:03 [PATCH 0/5] blk-mq: fix use-after-free on stale request Ming Lei
2020-08-20 18:03 ` [PATCH 1/5] blk-mq: define max_order for allocating rqs pages as macro Ming Lei
2020-08-20 18:03 ` [PATCH 2/5] blk-mq: add helper of blk_mq_get_hw_queue_node Ming Lei
2020-08-25  8:55   ` John Garry [this message]
2020-08-20 18:03 ` [PATCH 3/5] blk-mq: add helpers for allocating/freeing pages of request pool Ming Lei
2020-08-20 18:03 ` [PATCH 4/5] blk-mq: cache freed request pool pages Ming Lei
2020-08-20 18:03 ` [PATCH 5/5] blk-mq: check and shrink freed request pool page Ming Lei
2020-08-20 20:30 ` [PATCH 0/5] blk-mq: fix use-after-free on stale request Bart Van Assche
2020-08-21  2:49   ` Ming Lei
2020-08-26 12:03     ` John Garry
2020-08-26 12:24       ` Ming Lei
2020-08-26 12:34         ` Ming Lei
2020-08-26 12:56           ` John Garry

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=f9b37b2e-2e18-99ea-ed3f-b5c857338694@huawei.com \
    --to=john.garry@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.de \
    --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).