From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Lai Jiangshan <jiangshanlai@gmail.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Sagi Grimberg <sagi@grimberg.me>,
Bart Van Assche <bvanassche@acm.org>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Chao Leng <lengchao@huawei.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING
Date: Fri, 21 Aug 2020 08:34:48 +0200 [thread overview]
Message-ID: <20200821063448.GF28559@lst.de> (raw)
In-Reply-To: <20200820030248.2809559-1-ming.lei@redhat.com>
> -static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
> - __releases(hctx->srcu)
> +static void hctx_unlock(struct blk_mq_hw_ctx *hctx)
> {
> if (!(hctx->flags & BLK_MQ_F_BLOCKING))
> rcu_read_unlock();
> else
> - srcu_read_unlock(hctx->srcu, srcu_idx);
> + percpu_ref_put(&hctx->queue->dispatch_counter);
While you're at it: can we avoid the pointless inversion in the if
statement and just do:
if (hctx->flags & BLK_MQ_F_BLOCKING)
percpu_ref_put(&hctx->queue->dispatch_counter);
else
rcu_read_unlock();
> +static inline bool hctx_lock(struct blk_mq_hw_ctx *hctx)
> {
> if (!(hctx->flags & BLK_MQ_F_BLOCKING)) {
> - /* shut up gcc false positive */
> - *srcu_idx = 0;
> rcu_read_lock();
> + return true;
> } else
> - *srcu_idx = srcu_read_lock(hctx->srcu);
> + return percpu_ref_tryget_live(&hctx->queue->dispatch_counter);
> }
Same here.
Otherwise this looks good to me, but did you do a deep audit that all
the new hctx_lock() failure cases don't cause problems?
next prev parent reply other threads:[~2020-08-21 6:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 3:02 [PATCH] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING Ming Lei
2020-08-21 6:34 ` Christoph Hellwig [this message]
2020-08-21 10:16 ` Ming Lei
2020-08-21 14:46 ` Jens Axboe
2020-08-21 15:05 ` Jens Axboe
2020-08-21 20:14 ` Sagi Grimberg
2020-08-22 13:39 ` Ming Lei
2020-08-24 8:19 ` Sagi Grimberg
2020-08-24 10:40 ` Ming Lei
2020-08-24 21:34 ` Sagi Grimberg
2020-08-25 2:32 ` Ming Lei
2020-08-25 5:24 ` Sagi Grimberg
2020-08-25 9:41 ` Chao Leng
2020-08-25 17:38 ` Sagi Grimberg
2020-08-26 7:25 ` 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=20200821063448.GF28559@lst.de \
--to=hch@lst.de \
--cc=Johannes.Thumshirn@wdc.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=lengchao@huawei.com \
--cc=linux-block@vger.kernel.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