From: Chao Leng <lengchao@huawei.com>
To: <paulmck@kernel.org>, Christoph Hellwig <hch@lst.de>
Cc: <linux-nvme@lists.infradead.org>, <linux-block@vger.kernel.org>,
<sagi@grimberg.me>, <kbusch@kernel.org>, <ming.lei@redhat.com>,
<axboe@kernel.dk>
Subject: Re: [PATCH v2 1/2] blk-mq: add tagset quiesce interface
Date: Tue, 18 Oct 2022 17:52:06 +0800 [thread overview]
Message-ID: <3bb8a547-b2e2-7654-55dc-e943ac9aa06d@huawei.com> (raw)
In-Reply-To: <20221017152136.GI5600@paulmck-ThinkPad-P17-Gen-1>
On 2022/10/17 23:21, Paul E. McKenney wrote:
> On Mon, Oct 17, 2022 at 03:39:06PM +0200, Christoph Hellwig wrote:
>> On Thu, Oct 13, 2022 at 05:44:49PM +0800, Chao Leng wrote:
>>> + rcu = kvmalloc(count * sizeof(*rcu), GFP_KERNEL);
>>> + if (rcu) {
>>> + list_for_each_entry(q, &set->tag_list, tag_set_list) {
>>> + if (blk_queue_noquiesced(q))
>>> + continue;
>>> +
>>> + init_rcu_head(&rcu[i].head);
>>> + init_completion(&rcu[i].completion);
>>> + call_srcu(q->srcu, &rcu[i].head, wakeme_after_rcu);
>>> + i++;
>>> + }
>>> +
>>> + for (i = 0; i < count; i++) {
>>> + wait_for_completion(&rcu[i].completion);
>>> + destroy_rcu_head(&rcu[i].head);
>>> + }
>>> + kvfree(rcu);
>>> + } else {
>>> + list_for_each_entry(q, &set->tag_list, tag_set_list)
>>> + synchronize_srcu(q->srcu);
>>> + }
>>
>> Having to allocate a struct rcu_synchronize for each of the potentially
>> many queues here is a bit sad.
>>
>> Pull just explained the start_poll_synchronize_rcu interfaces at ALPSS
>> last week, so I wonder if something like that would also be feasible
>> for SRCU, as that would come in really handy here.
>
> There is start_poll_synchronize_srcu() and poll_state_synchronize_srcu(),
> but there would need to be an unsigned long for each srcu_struct from
> which an SRCU grace period was required. This would be half the size
> of the "rcu" array above, but still maybe larger than you would like.
>
> The resulting code might look something like this, with "rcu" now being
> a pointer to unsigned long:
>
> rcu = kvmalloc(count * sizeof(*rcu), GFP_KERNEL);
> if (rcu) {
> list_for_each_entry(q, &set->tag_list, tag_set_list) {
> if (blk_queue_noquiesced(q))
> continue;
> rcu[i] = start_poll_synchronize_srcu(q->srcu);
> i++;
> }
>
> for (i = 0; i < count; i++)
> if (!poll_state_synchronize_srcu(q->srcu))
> synchronize_srcu(q->srcu);
synchronize_srcu will restart a new period of grace.
Maybe it would be better like this:
while (!poll_state_synchronize_srcu(q->srcu, rcu[i]))
schedule_timeout_uninterruptible(1);
> kvfree(rcu);
> } else {
> list_for_each_entry(q, &set->tag_list, tag_set_list)
> synchronize_srcu(q->srcu);
> }
>
> Or as Christoph suggested, just have a single srcu_struct for the
> whole group.
>
> The main reason for having multiple srcu_struct structures is to
> prevent the readers from one from holding up the updaters from another.
> Except that by waiting for the multiple grace periods, you are losing
> that property anyway, correct? Or is this code waiting on only a small
> fraction of the srcu_struct structures associated with blk_queue?
>
> Thanx, Paul
> .
>
next prev parent reply other threads:[~2022-10-18 9:52 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 9:44 [PATCH v2 0/2] improve nvme quiesce time for large amount of namespaces Chao Leng
2022-10-13 9:44 ` [PATCH v2 1/2] blk-mq: add tagset quiesce interface Chao Leng
2022-10-13 10:28 ` Sagi Grimberg
2022-10-14 2:09 ` Chao Leng
2022-10-17 13:43 ` Christoph Hellwig
2022-10-18 9:51 ` Chao Leng
2022-10-17 13:39 ` Christoph Hellwig
2022-10-17 13:42 ` Christoph Hellwig
2022-10-18 8:39 ` Sagi Grimberg
2022-10-18 8:55 ` Christoph Hellwig
2022-10-18 9:06 ` Sagi Grimberg
2022-10-18 11:05 ` Christoph Hellwig
2022-10-18 9:52 ` Chao Leng
2022-10-17 15:21 ` Paul E. McKenney
2022-10-17 15:31 ` Christoph Hellwig
2022-10-17 22:41 ` Paul E. McKenney
2022-10-18 5:19 ` Christoph Hellwig
2022-10-19 0:35 ` Ming Lei
2022-10-19 7:15 ` Sagi Grimberg
2022-10-19 7:25 ` Christoph Hellwig
2022-10-19 7:27 ` Christoph Hellwig
2022-10-19 7:30 ` Sagi Grimberg
2022-10-19 7:32 ` Christoph Hellwig
2022-10-19 7:57 ` Sagi Grimberg
2022-10-19 8:17 ` Christoph Hellwig
2022-10-19 8:29 ` Sagi Grimberg
2022-10-18 9:52 ` Chao Leng [this message]
2022-10-18 15:04 ` Paul E. McKenney
2022-10-19 2:39 ` Chao Leng
2022-10-18 9:52 ` Chao Leng
2022-10-13 9:44 ` [PATCH v2 2/2] nvme: use blk_mq_[un]quiesce_tagset Chao Leng
2022-10-13 10:22 ` Sagi Grimberg
2022-10-14 2:09 ` Chao Leng
2022-10-17 13:48 ` Christoph Hellwig
2022-10-13 14:32 ` [PATCH v2 0/2] improve nvme quiesce time for large amount of namespaces Chaitanya Kulkarni
2022-10-14 2:12 ` Chao Leng
2022-10-15 0:30 ` Chaitanya Kulkarni
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=3bb8a547-b2e2-7654-55dc-e943ac9aa06d@huawei.com \
--to=lengchao@huawei.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
--cc=paulmck@kernel.org \
--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