From: Dongli Zhang <dongli.zhang@oracle.com>
To: luferry <luferry@163.com>
Cc: Jens Axboe <axboe@kernel.dk>, Ming Lei <ming.lei@redhat.com>,
Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block/mq: blk map queues by core id
Date: Fri, 22 Mar 2019 19:58:08 +0800 [thread overview]
Message-ID: <9fa3eda2-536c-86a1-a7a3-c157fd0cdfdc@oracle.com> (raw)
In-Reply-To: <20190322100949.5555-1-luferry@163.com>
On 03/22/2019 06:09 PM, luferry wrote:
> under virtual machine environment, cpu topology may differ from normal
> physical server.
Would mind share the name of virtual machine monitor, the command line if
available, and which device to reproduce.
For instance, I am not able to reproduce with qemu nvme or virtio-blk as I
assume they use pci or virtio specific mapper to establish the mapping.
E.g., with qemu and nvme: -smp 8,sockets=1,cores=4,threads=2
Indeed I use three queues instead of twp as one is reserved for admin.
# ls /sys/block/nvme0n1/mq/*
/sys/block/nvme0n1/mq/0:
cpu0 cpu1 cpu2 cpu3 cpu_list nr_reserved_tags nr_tags
/sys/block/nvme0n1/mq/1:
cpu4 cpu5 cpu6 cpu7 cpu_list nr_reserved_tags nr_tags
Thank you very much!
Dongli Zhang
> for example (machine with 4 cores, 2 threads per core):
>
> normal physical server:
> core-id thread-0-id thread-1-id
> 0 0 4
> 1 1 5
> 2 2 6
> 3 3 7
>
> virtual machine:
> core-id thread-0-id thread-1-id
> 0 0 1
> 1 2 3
> 2 4 5
> 3 6 7
>
> When attach disk with two queues, all the even numbered cpus will be
> mapped to queue 0. Under virtual machine, all the cpus is followed by
> its sibling cpu.Before this patch, all the odd numbered cpus will also
> be mapped to queue 0, can cause serious imbalance.this will lead to
> performance impact on system IO
>
> So suggest to allocate cpu map by core id, this can be more currency
>
> Signed-off-by: luferry <luferry@163.com>
> ---
> block/blk-mq-cpumap.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
> index 03a534820271..4125e8e77679 100644
> --- a/block/blk-mq-cpumap.c
> +++ b/block/blk-mq-cpumap.c
> @@ -35,7 +35,7 @@ int blk_mq_map_queues(struct blk_mq_queue_map *qmap)
> {
> unsigned int *map = qmap->mq_map;
> unsigned int nr_queues = qmap->nr_queues;
> - unsigned int cpu, first_sibling;
> + unsigned int cpu, first_sibling, core = 0;
>
> for_each_possible_cpu(cpu) {
> /*
> @@ -48,9 +48,10 @@ int blk_mq_map_queues(struct blk_mq_queue_map *qmap)
> map[cpu] = cpu_to_queue_index(qmap, nr_queues, cpu);
> } else {
> first_sibling = get_first_sibling(cpu);
> - if (first_sibling == cpu)
> - map[cpu] = cpu_to_queue_index(qmap, nr_queues, cpu);
> - else
> + if (first_sibling == cpu) {
> + map[cpu] = cpu_to_queue_index(qmap, nr_queues, core);
> + core++;
> + } else
> map[cpu] = map[first_sibling];
> }
> }
>
next prev parent reply other threads:[~2019-03-22 11:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 10:09 [PATCH] block/mq: blk map queues by core id luferry
2019-03-22 11:53 ` Dongli Zhang
2019-03-22 11:58 ` Dongli Zhang [this message]
2019-03-23 6:34 ` luferry
2019-03-23 11:14 ` Dongli Zhang
2019-03-25 9:49 ` luferry
2019-03-25 9:53 ` luferry
2019-03-25 13:53 ` Dongli Zhang
2019-03-25 15:17 ` luferry
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=9fa3eda2-536c-86a1-a7a3-c157fd0cdfdc@oracle.com \
--to=dongli.zhang@oracle.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luferry@163.com \
--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