From: Hannes Reinecke <hare@suse.de>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>,
Bart Van Assche <bvanassche@acm.org>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Chao Leng <lengchao@huawei.com>
Subject: Re: [PATCH V3 2/4] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING
Date: Tue, 8 Sep 2020 10:44:40 +0200 [thread overview]
Message-ID: <54fce956-4e8f-6e4b-0ae1-e0905a06f3e4@suse.de> (raw)
In-Reply-To: <20200908081538.1434936-3-ming.lei@redhat.com>
On 9/8/20 10:15 AM, Ming Lei wrote:
> In case of BLK_MQ_F_BLOCKING, blk-mq uses SRCU to mark read critical
> section during dispatching request, then request queue quiesce is based on
> SRCU. What we want to get is low cost added in fast path.
>
> With percpu-ref, it is cleaner and simpler & enough for implementing queue
> quiesce. The main requirement is to make sure all read sections to observe
> QUEUE_FLAG_QUIESCED once blk_mq_quiesce_queue() returns.
>
> Also it becomes much easier to add interface of async queue quiesce.
>
> Meantime memory footprint can be reduced with per-request-queue percpu-ref.
>
> From implementation viewpoint, in fast path, not see percpu_ref is
> slower than SRCU, and srcu tree(default option in most distributions)
> could be slower since memory barrier is required in both lock & unlock,
> and rcu_read_lock()/rcu_read_unlock() should be much cheap than
> smp_mb().
>
> 1) percpu_ref just hold the rcu_read_lock, then run a check &
> increase/decrease on the percpu variable:
>
> rcu_read_lock()
> if (__ref_is_percpu(ref, &percpu_count))
> this_cpu_inc(*percpu_count);
> rcu_read_unlock()
>
> 2) srcu tree:
> idx = READ_ONCE(ssp->srcu_idx) & 0x1;
> this_cpu_inc(ssp->sda->srcu_lock_count[idx]);
> smp_mb(); /* B */ /* Avoid leaking the critical section. */
>
> Also from my test on null_blk(blocking), not observe percpu-ref performs
> worse than srcu, see the following test:
>
> 1) test steps:
>
> rmmod null_blk > /dev/null 2>&1
> modprobe null_blk nr_devices=1 submit_queues=1 blocking=1
> fio --bs=4k --size=512G --rw=randread --norandommap --direct=1 --ioengine=libaio \
> --iodepth=64 --runtime=60 --group_reporting=1 --name=nullb0 \
> --filename=/dev/nullb0 --numjobs=32
>
> test machine: HP DL380, 16 cpu cores, 2 threads per core, dual
> sockets/numa, Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz
>
> 2) test result:
> - srcu quiesce: 6063K IOPS
> - percpu-ref quiesce: 6113K IOPS
>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
> Cc: Chao Leng <lengchao@huawei.com>
> ---
> block/blk-mq-sysfs.c | 2 -
> block/blk-mq.c | 130 +++++++++++++++++++++--------------------
> block/blk-sysfs.c | 6 +-
> include/linux/blk-mq.h | 8 ---
> include/linux/blkdev.h | 4 ++
> 5 files changed, 77 insertions(+), 73 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
next prev parent reply other threads:[~2020-09-08 8:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 8:15 [PATCH V3 0/4] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING Ming Lei
2020-09-08 8:15 ` [PATCH V3 1/4] blk-mq: serialize queue quiesce and unquiesce by mutex Ming Lei
2020-09-08 8:38 ` Hannes Reinecke
2020-09-08 11:31 ` Johannes Thumshirn
2020-09-08 17:54 ` Bart Van Assche
2020-09-09 1:16 ` Ming Lei
2020-09-08 8:15 ` [PATCH V3 2/4] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING Ming Lei
2020-09-08 8:44 ` Hannes Reinecke [this message]
2020-09-08 9:13 ` Chao Leng
2020-09-08 9:27 ` Ming Lei
2020-09-08 15:31 ` Keith Busch
2020-09-09 1:19 ` Ming Lei
2020-09-08 8:15 ` [PATCH V3 3/4] blk-mq: add tagset quiesce interface Ming Lei
2020-09-08 8:45 ` Hannes Reinecke
2020-09-08 8:15 ` [PATCH V3 4/4] nvme: use blk_mq_[un]quiesce_tagset Ming Lei
2020-09-08 8:46 ` Hannes Reinecke
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=54fce956-4e8f-6e4b-0ae1-e0905a06f3e4@suse.de \
--to=hare@suse.de \
--cc=Johannes.Thumshirn@wdc.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=lengchao@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
/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