From: Christoph Hellwig <hch@lst.de> To: Ming Lei <ming.lei@redhat.com> Cc: Sagi Grimberg <sagi@grimberg.me>, Jens Axboe <axboe@kernel.dk>, "Paul E. McKenney" <paulmck@kernel.org>, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Chao Leng <lengchao@huawei.com>, Keith Busch <kbusch@kernel.org>, Ming Lin <mlin@kernel.org>, Christoph Hellwig <hch@lst.de> Subject: Re: [PATCH v5 1/2] blk-mq: add tagset quiesce interface Date: Tue, 28 Jul 2020 12:57:41 +0200 [thread overview] Message-ID: <20200728105741.GA29763@lst.de> (raw) In-Reply-To: <20200728101042.GA1336890@T590> On Tue, Jul 28, 2020 at 06:10:42PM +0800, Ming Lei wrote: > + struct blk_mq_hw_ctx *hctx = (void *)srcu - > + sizeof(struct blk_mq_hw_ctx); I think this should use container_of. > +{ > + struct blk_mq_hw_ctx *hctx; > + unsigned int i; > + > + blk_mq_quiesce_queue_nowait(q); > + > + queue_for_each_hw_ctx(q, hctx, i) { > + WARN_ON_ONCE(!(hctx->flags & BLK_MQ_F_BLOCKING)); > + init_rcu_head(&hctx->srcu->head); We only need to initialize the rcu head once when we allocate the hctx. > + mutex_lock(&set->tag_list_lock); > + if (set->flags & BLK_MQ_F_BLOCKING) { > + int count = 0; > + > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + count++; > + > + atomic_set(&set->quiesce_count, count); > + init_completion(&set->quiesce_completion); > + > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + blk_mq_quiesce_blocking_queue_async(q); > + wait_for_completion(&set->quiesce_completion); > + } else { > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + blk_mq_quiesce_queue_nowait(q); > + synchronize_rcu(); > + } > + mutex_unlock(&set->tag_list_lock); It would be great to do the wait_for_completion and synchronize_rcu outside the lock. Also I think the blocking case probably wants to be split into a separate little helper.
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de> To: Ming Lei <ming.lei@redhat.com> Cc: Jens Axboe <axboe@kernel.dk>, Sagi Grimberg <sagi@grimberg.me>, "Paul E. McKenney" <paulmck@kernel.org>, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Chao Leng <lengchao@huawei.com>, Keith Busch <kbusch@kernel.org>, Ming Lin <mlin@kernel.org>, Christoph Hellwig <hch@lst.de> Subject: Re: [PATCH v5 1/2] blk-mq: add tagset quiesce interface Date: Tue, 28 Jul 2020 12:57:41 +0200 [thread overview] Message-ID: <20200728105741.GA29763@lst.de> (raw) In-Reply-To: <20200728101042.GA1336890@T590> On Tue, Jul 28, 2020 at 06:10:42PM +0800, Ming Lei wrote: > + struct blk_mq_hw_ctx *hctx = (void *)srcu - > + sizeof(struct blk_mq_hw_ctx); I think this should use container_of. > +{ > + struct blk_mq_hw_ctx *hctx; > + unsigned int i; > + > + blk_mq_quiesce_queue_nowait(q); > + > + queue_for_each_hw_ctx(q, hctx, i) { > + WARN_ON_ONCE(!(hctx->flags & BLK_MQ_F_BLOCKING)); > + init_rcu_head(&hctx->srcu->head); We only need to initialize the rcu head once when we allocate the hctx. > + mutex_lock(&set->tag_list_lock); > + if (set->flags & BLK_MQ_F_BLOCKING) { > + int count = 0; > + > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + count++; > + > + atomic_set(&set->quiesce_count, count); > + init_completion(&set->quiesce_completion); > + > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + blk_mq_quiesce_blocking_queue_async(q); > + wait_for_completion(&set->quiesce_completion); > + } else { > + list_for_each_entry(q, &set->tag_list, tag_set_list) > + blk_mq_quiesce_queue_nowait(q); > + synchronize_rcu(); > + } > + mutex_unlock(&set->tag_list_lock); It would be great to do the wait_for_completion and synchronize_rcu outside the lock. Also I think the blocking case probably wants to be split into a separate little helper. _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-07-28 10:57 UTC|newest] Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-27 23:10 [PATCH v5 0/2] improve nvme quiesce time for large amount of namespaces Sagi Grimberg 2020-07-27 23:10 ` Sagi Grimberg 2020-07-27 23:10 ` [PATCH v5 1/2] blk-mq: add tagset quiesce interface Sagi Grimberg 2020-07-27 23:10 ` Sagi Grimberg 2020-07-27 23:32 ` Keith Busch 2020-07-27 23:32 ` Keith Busch 2020-07-28 0:12 ` Sagi Grimberg 2020-07-28 0:12 ` Sagi Grimberg 2020-07-28 1:40 ` Ming Lei 2020-07-28 1:40 ` Ming Lei 2020-07-28 1:51 ` Jens Axboe 2020-07-28 1:51 ` Jens Axboe 2020-07-28 2:17 ` Ming Lei 2020-07-28 2:17 ` Ming Lei 2020-07-28 2:23 ` Jens Axboe 2020-07-28 2:23 ` Jens Axboe 2020-07-28 2:28 ` Ming Lei 2020-07-28 2:28 ` Ming Lei 2020-07-28 2:32 ` Jens Axboe 2020-07-28 2:32 ` Jens Axboe 2020-07-28 3:29 ` Sagi Grimberg 2020-07-28 3:29 ` Sagi Grimberg 2020-07-28 3:25 ` Sagi Grimberg 2020-07-28 3:25 ` Sagi Grimberg 2020-07-28 7:18 ` Christoph Hellwig 2020-07-28 7:18 ` Christoph Hellwig 2020-07-28 7:48 ` Sagi Grimberg 2020-07-28 7:48 ` Sagi Grimberg 2020-07-28 9:16 ` Ming Lei 2020-07-28 9:16 ` Ming Lei 2020-07-28 9:24 ` Sagi Grimberg 2020-07-28 9:24 ` Sagi Grimberg 2020-07-28 9:33 ` Ming Lei 2020-07-28 9:33 ` Ming Lei 2020-07-28 9:37 ` Sagi Grimberg 2020-07-28 9:37 ` Sagi Grimberg 2020-07-28 9:43 ` Sagi Grimberg 2020-07-28 9:43 ` Sagi Grimberg 2020-07-28 10:10 ` Ming Lei 2020-07-28 10:10 ` Ming Lei 2020-07-28 10:57 ` Christoph Hellwig [this message] 2020-07-28 10:57 ` Christoph Hellwig 2020-07-28 14:13 ` Paul E. McKenney 2020-07-28 14:13 ` Paul E. McKenney 2020-07-28 10:58 ` Christoph Hellwig 2020-07-28 10:58 ` Christoph Hellwig 2020-07-28 16:25 ` Sagi Grimberg 2020-07-28 16:25 ` Sagi Grimberg 2020-07-28 13:54 ` Paul E. McKenney 2020-07-28 13:54 ` Paul E. McKenney 2020-07-28 23:46 ` Sagi Grimberg 2020-07-28 23:46 ` Sagi Grimberg 2020-07-29 0:31 ` Paul E. McKenney 2020-07-29 0:31 ` Paul E. McKenney 2020-07-29 0:43 ` Sagi Grimberg 2020-07-29 0:43 ` Sagi Grimberg 2020-07-29 0:59 ` Keith Busch 2020-07-29 0:59 ` Keith Busch 2020-07-29 4:39 ` Sagi Grimberg 2020-07-29 4:39 ` Sagi Grimberg 2020-08-07 9:04 ` Chao Leng 2020-08-07 9:04 ` Chao Leng 2020-08-07 9:24 ` Ming Lei 2020-08-07 9:24 ` Ming Lei 2020-08-07 9:35 ` Chao Leng 2020-08-07 9:35 ` Chao Leng 2020-07-29 4:10 ` Paul E. McKenney 2020-07-29 4:10 ` Paul E. McKenney 2020-07-29 4:37 ` Sagi Grimberg 2020-07-29 4:37 ` Sagi Grimberg 2020-07-27 23:10 ` [PATCH v5 2/2] nvme: use blk_mq_[un]quiesce_tagset Sagi Grimberg 2020-07-27 23:10 ` Sagi Grimberg 2020-07-28 0:54 ` Sagi Grimberg 2020-07-28 0:54 ` Sagi Grimberg 2020-07-28 3:21 ` Chao Leng 2020-07-28 3:21 ` Chao Leng 2020-07-28 3:34 ` Sagi Grimberg 2020-07-28 3:34 ` Sagi Grimberg 2020-07-28 3:51 ` Chao Leng 2020-07-28 3:51 ` Chao Leng
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=20200728105741.GA29763@lst.de \ --to=hch@lst.de \ --cc=axboe@kernel.dk \ --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=mlin@kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.