public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Leng <lengchao@huawei.com>
To: Sagi Grimberg <sagi@grimberg.me>, 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>,
	Bart Van Assche <bvanassche@acm.org>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING
Date: Wed, 26 Aug 2020 15:25:56 +0800	[thread overview]
Message-ID: <255fa307-f2e8-4eab-bdbf-8b697b215663@huawei.com> (raw)
In-Reply-To: <6cef7a24-f19c-a39a-abd8-2f0ea50fb7a2@grimberg.me>



On 2020/8/26 1:38, Sagi Grimberg wrote:
> 
>>>>> Good, but I'd also won't want to get this without making sure the async
>>>>> quiesce works well on large number of namespaces (the reason why this
>>>>> is proposed in the first place). Not sure who is planning to do that...
>>>>
>>>> That can be added when async quiesce is done.
>>>
>>> Chao, are you looking into that? I'd really hate to find out we have an
>>> issue there post conversion...
>>
>> Now we config CONFIG_TREE_SRCU, the size of TREE_SRCU is too big. I
>> really appreciate the work of Ming.
>>
>> I review the patch, I think the patch may work well now, but do extra
>> works for exception scenario. Percpu_ref is not disigned for
>> serialization which read low cost. If we replace SRCU with percpu_ref,
>> the benefit is save memory for blocking queue, the price is limit future
>> changes or do more extra works.
>>
>> I do not think replace SRCU with percpu_ref is a good idea, because it's
>> hard to predict how much we'll lose.
> 
> Not sure I understand your point, can you clarify what is the poor
> design of percpu_ref and for which use-case?
> .
1.percpu_ref need introduce fail status for hctc_lock to avoid possible
long waits for synchronization, need do some extra work for failed hctx_lock .
Just like this which in the patch:
@@ -2057,11 +2051,14 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
  		struct request *rq, blk_qc_t *cookie)
  {
  	blk_status_t ret;
-	int srcu_idx;

  	might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);

-	hctx_lock(hctx, &srcu_idx);
+	/* Insert request to queue in case of being quiesced */
+	if (!hctx_lock(hctx)) {
+		blk_mq_sched_insert_request(rq, false, false, false);
+		return;
+	}

Now is simple, the code can work well. If the logic gets complicated,
it's probably hard to handle.
For example: for some unkown reason, if we may introduce some mechanism(such
as check other flag or state) for dispatch or issue requests, we may need do
more extra works in the branch of failed hctx_lock. perhaps more seriously,
it may hard to be handled in this branch. If we need do like this
in __blk_mq_try_issue_directly.
	if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {
		run_queue = false;
		bypass_insert = false;
		goto insert;
+	} else if (blk_queue_xxx(q)) {
+		/*do some other things*/
+       }
Of course, there's a good chance it won't happen.



      reply	other threads:[~2020-08-26  7:26 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
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 [this message]

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=255fa307-f2e8-4eab-bdbf-8b697b215663@huawei.com \
    --to=lengchao@huawei.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --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