[v4,12/14] blk-mq: remove set of bd->last when get driver tag for next request fails
Message ID | 20230118093726.3939160-12-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2085109wrn; Tue, 17 Jan 2023 17:41:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXt6r2ZMsANW0HW394A/9e+O37Lhp7XsBypitdXbMyv59kk5bTv27I/MAhwfh5qvvsMUCKDT X-Received: by 2002:a17:902:6ac5:b0:191:7d3:7fdd with SMTP id i5-20020a1709026ac500b0019107d37fddmr27236164plt.60.1674006114452; Tue, 17 Jan 2023 17:41:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674006114; cv=none; d=google.com; s=arc-20160816; b=X4oe1yY64nSrjZeDzaWpZxftkvcB5Dy6w6vhVfNNEKTo3CJfpfH7jO8R0Ov+MTbv2l k8ON8qo+OIQ654kFJJPGotfEphT/eCb27xwnyKerSaGIs8YzBvJLC2Zkr2OychS7qOfc rBiBxwDAmlVG5ImSunQ+P3CTiUkAEh7SffG35rlMORREYeOD0x/ZfTZl1BxSq8O6vYzj Le/1XInAFdeZpw+UoLg/f/zz3Q6RUqb9vWLiU18Q1SuNDzJSu9aDoHJnLdd8RqLstTaK iScIuV7IfHK2/a0mAcdcQ72+MIfuHAyh5/WRPRv0Imvv/TvrAKXf/eFaLMe9dJAaIF3w tBtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sXbsHNNVQa8EXgrUb3b51eAzO+C5evbUzGPaKrtv9Ug=; b=Jk/RP94ECKB6hTMeMu7BgBPAru/ZA8XQQ0gIHWWE8tER+9JAXbusW/ocGu9iHquw2r 20g3ghcnJZV4FZ0LPhgH5qF2y4e7+pNM10Uy4XDiDDGJoHTN4HwHQwca3kvQyj0FvfUU LWxRj3enFyr0QG+T1l1+Wkm93UBHNd2tkToLmD7Sx/ba+z0gvAv9a624TwIkgwre+JZw 2AurFq8CjtMgZuqwpPuJIfo8MsJsdpwTFXa9kciueTxCOjpRK8anGtge+PZi8c9eMwvL v+GEXXkuII5H+g9OHVQ3fQUX4KGcDnhG1oFsriL+atvFm5UojI2QQyv8ELWfeyj7mf82 Siwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020a170902b61700b00194821e608dsi10211204pls.387.2023.01.17.17.41.39; Tue, 17 Jan 2023 17:41:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbjARBkR (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Tue, 17 Jan 2023 20:40:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjARBjG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Jan 2023 20:39:06 -0500 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B936551C4E; Tue, 17 Jan 2023 17:39:04 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NxT1v4tHjz4f3jqY; Wed, 18 Jan 2023 09:38:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgDnjOqxTcdjBACUBw--.30342S13; Wed, 18 Jan 2023 09:39:02 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: hch@lst.de, axboe@kernel.dk, dwagner@suse.de, hare@suse.de, ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: john.garry@huawei.com, jack@suse.cz Subject: [PATCH v4 12/14] blk-mq: remove set of bd->last when get driver tag for next request fails Date: Wed, 18 Jan 2023 17:37:24 +0800 Message-Id: <20230118093726.3939160-12-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230118093726.3939160-1-shikemeng@huaweicloud.com> References: <20230118093726.3939160-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgDnjOqxTcdjBACUBw--.30342S13 X-Coremail-Antispam: 1UD129KBjvJXoW7ZryrKr17Cr1DAw1rCrWxWFg_yoW8Kr18pF W3Ja1akr45XF40gFW8AwsrWF45Jw4DArWayrs8u34Fqrn09rs7KFyxJ3y8ZFyFvrZ7CrsI gr4vgryDXr48XFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBSb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAv FVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3w A2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE 3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr2 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAI cVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUxD7aUUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, KHOP_HELO_FCRDNS,MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755322635376626024?= X-GMAIL-MSGID: =?utf-8?q?1755322635376626024?= |
Series |
A few bugfix and cleanup patches for blk-mq
|
|
Commit Message
Kemeng Shi
Jan. 18, 2023, 9:37 a.m. UTC
Commit 113285b473824 ("blk-mq: ensure that bd->last is always set
correctly") will set last if we failed to get driver tag for next
request to avoid flush miss as we break the list walk and will not
send the last request in the list which will be sent with last set
normally.
This code seems stale now becase the flush introduced is always
redundant as:
For case tag is really out, we will send a extra flush if we find
list is not empty after list walk.
For case some tag is freed before retry in blk_mq_prep_dispatch_rq for
next, then we can get a tag for next request in retry and flush notified
already is not necessary.
Just remove these stale codes.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
block/blk-mq.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
Comments
On Wed, Jan 18, 2023 at 05:37:24PM +0800, Kemeng Shi wrote: > Commit 113285b473824 ("blk-mq: ensure that bd->last is always set > correctly") will set last if we failed to get driver tag for next > request to avoid flush miss as we break the list walk and will not > send the last request in the list which will be sent with last set > normally. > This code seems stale now becase the flush introduced is always > redundant as: > For case tag is really out, we will send a extra flush if we find > list is not empty after list walk. > For case some tag is freed before retry in blk_mq_prep_dispatch_rq for > next, then we can get a tag for next request in retry and flush notified > already is not necessary. I think Ming will know this code better than me, but aren't we losing the blk_mq_get_driver_tag call entirely here now. Where is getting the driver tag covered now?
on 1/19/2023 1:42 AM, Christoph Hellwig wrote: > On Wed, Jan 18, 2023 at 05:37:24PM +0800, Kemeng Shi wrote: >> Commit 113285b473824 ("blk-mq: ensure that bd->last is always set >> correctly") will set last if we failed to get driver tag for next >> request to avoid flush miss as we break the list walk and will not >> send the last request in the list which will be sent with last set >> normally. >> This code seems stale now becase the flush introduced is always >> redundant as: >> For case tag is really out, we will send a extra flush if we find >> list is not empty after list walk. >> For case some tag is freed before retry in blk_mq_prep_dispatch_rq for >> next, then we can get a tag for next request in retry and flush notified >> already is not necessary. > > I think Ming will know this code better than me, but aren't we > losing the blk_mq_get_driver_tag call entirely here now. Where > is getting the driver tag covered now? > We will get driver tag in blk_mq_prep_dispatch_rq at beginning of dispatch loop, so it's fine to remove blk_mq_get_driver_tag here. Thanks.
on 1/19/2023 9:45 AM, Kemeng Shi wrote: > > > on 1/19/2023 1:42 AM, Christoph Hellwig wrote: >> On Wed, Jan 18, 2023 at 05:37:24PM +0800, Kemeng Shi wrote: >>> Commit 113285b473824 ("blk-mq: ensure that bd->last is always set >>> correctly") will set last if we failed to get driver tag for next >>> request to avoid flush miss as we break the list walk and will not >>> send the last request in the list which will be sent with last set >>> normally. >>> This code seems stale now becase the flush introduced is always >>> redundant as: >>> For case tag is really out, we will send a extra flush if we find >>> list is not empty after list walk. >>> For case some tag is freed before retry in blk_mq_prep_dispatch_rq for >>> next, then we can get a tag for next request in retry and flush notified >>> already is not necessary. >> >> I think Ming will know this code better than me, but aren't we >> losing the blk_mq_get_driver_tag call entirely here now. Where >> is getting the driver tag covered now? >> > We will get driver tag in blk_mq_prep_dispatch_rq at beginning of dispatch > loop, so it's fine to remove blk_mq_get_driver_tag here. Thanks. > Hi Ming and everyone familiar with code invovled, could you help with reviewing this patch and patch "[PATCH v4 04/14] blk-mq: Fix potential io hung for shared sbitmap per tagset" in the same patchset. Thanks.
on 1/28/2023 10:03 AM, Kemeng Shi wrote: > > > on 1/19/2023 9:45 AM, Kemeng Shi wrote: >> >> >> on 1/19/2023 1:42 AM, Christoph Hellwig wrote: >>> On Wed, Jan 18, 2023 at 05:37:24PM +0800, Kemeng Shi wrote: >>>> Commit 113285b473824 ("blk-mq: ensure that bd->last is always set >>>> correctly") will set last if we failed to get driver tag for next >>>> request to avoid flush miss as we break the list walk and will not >>>> send the last request in the list which will be sent with last set >>>> normally. >>>> This code seems stale now becase the flush introduced is always >>>> redundant as: >>>> For case tag is really out, we will send a extra flush if we find >>>> list is not empty after list walk. >>>> For case some tag is freed before retry in blk_mq_prep_dispatch_rq for >>>> next, then we can get a tag for next request in retry and flush notified >>>> already is not necessary. >>> >>> I think Ming will know this code better than me, but aren't we >>> losing the blk_mq_get_driver_tag call entirely here now. Where >>> is getting the driver tag covered now? >>> >> We will get driver tag in blk_mq_prep_dispatch_rq at beginning of dispatch >> loop, so it's fine to remove blk_mq_get_driver_tag here. Thanks. >> > > Hi Ming and everyone familiar with code invovled, could you help with > reviewing this patch and patch "[PATCH v4 04/14] blk-mq: Fix potential > io hung for shared sbitmap per tagset" in the same patchset. > Thanks. > Could anyone please help review the last two patches without reviewed-by. Thanks.
On Mon, Feb 06, 2023 at 09:05:25AM +0800, Kemeng Shi wrote:
> Could anyone please help review the last two patches without reviewed-by.
I'm still not really convinved of this one patch.
The rest of the series looks like great small cleanups, but this one
isn't quite as trivial. Maybe you can split it from the series and
resend it with a more detailed and better explanation for the next
merge window?
diff --git a/block/blk-mq.c b/block/blk-mq.c index 90471b5c868f..afd4f0c3166b 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1923,16 +1923,6 @@ static void blk_mq_update_dispatch_busy(struct blk_mq_hw_ctx *hctx, bool busy) static void blk_mq_handle_dev_resource(struct request *rq, struct list_head *list) { - struct request *next = - list_first_entry_or_null(list, struct request, queuelist); - - /* - * If an I/O scheduler has been configured and we got a driver tag for - * the next request already, free it. - */ - if (next) - blk_mq_put_driver_tag(next); - list_add(&rq->queuelist, list); __blk_mq_requeue_request(rq); } @@ -2032,7 +2022,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list, { enum prep_dispatch prep; struct request_queue *q = hctx->queue; - struct request *rq, *nxt; + struct request *rq; int queued; blk_status_t ret = BLK_STS_OK; LIST_HEAD(zone_list); @@ -2058,17 +2048,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list, list_del_init(&rq->queuelist); bd.rq = rq; - - /* - * Flag last if we have no more requests, or if we have more - * but can't assign a driver tag to it. - */ - if (list_empty(list)) - bd.last = true; - else { - nxt = list_first_entry(list, struct request, queuelist); - bd.last = !blk_mq_get_driver_tag(nxt); - } + bd.last = list_empty(list); /* * once the request is queued to lld, no need to cover the