linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Hillf Danton <hdanton@sina.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@fb.com>,
	Ming Lin <ming.l@ssi.samsung.com>,
	Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] blk-mq: fix selecting software ctx for request
Date: Mon, 3 Feb 2020 17:16:02 +0800	[thread overview]
Message-ID: <20200203091602.GA31450@ming.t460p> (raw)
In-Reply-To: <20200202102004.19132-1-hdanton@sina.com>

On Sun, Feb 02, 2020 at 06:20:04PM +0800, Hillf Danton wrote:
> 
> Select the current cpu if it's mapped to hardware to make helpers like
> blk_mq_rq_cpu() return correct value.
> 
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
> 
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -454,7 +454,10 @@ struct request *blk_mq_alloc_request_hct
>  		blk_queue_exit(q);
>  		return ERR_PTR(-EXDEV);
>  	}
> -	cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask);
> +	cpu = raw_smp_processor_id();
> +	if (!cpumask_test_cpu(cpu, alloc_data.hctx->cpumask))
> +		cpu = cpumask_first_and(alloc_data.hctx->cpumask,
> +						cpu_online_mask);

How can you know if there is any online CPU available for this hctx?

>  	alloc_data.ctx = __blk_mq_get_ctx(q, cpu);
>  
>  	rq = blk_mq_get_request(q, NULL, &alloc_data);
> 

It is really one NVMe specific issue, see the following discussion:

https://lore.kernel.org/linux-block/8f4402a0-967d-f12d-2f1a-949e1dda017c@grimberg.me/#r


Thanks,
Ming


       reply	other threads:[~2020-02-03  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200202102004.19132-1-hdanton@sina.com>
2020-02-03  9:16 ` Ming Lei [this message]
     [not found] ` <20200203102815.3940-1-hdanton@sina.com>
2020-02-03 12:29   ` [PATCH] blk-mq: fix selecting software ctx for request Ming Lei

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=20200203091602.GA31450@ming.t460p \
    --to=ming.lei@redhat.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=hdanton@sina.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.l@ssi.samsung.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).