[v2,01/10] block, bfq: correctly raise inject limit in bfq_choose_bfqq_for_injection
Message ID | 20221216111230.3638832-2-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp743624wrn; Thu, 15 Dec 2022 19:15:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fsh8EqzEg92T9jE6AlYBzE9LvSkvckiDo/Jsrd5tukwAi83WHd8i4psNHFY/G/v982zEy X-Received: by 2002:a05:6402:1ccc:b0:461:8be6:1ac4 with SMTP id ds12-20020a0564021ccc00b004618be61ac4mr28060556edb.20.1671160500942; Thu, 15 Dec 2022 19:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671160500; cv=none; d=google.com; s=arc-20160816; b=hVRYjh3FJOX/C8y8YH8xWK4M83EOmBbz+hB2GEh+odlZtJ61gOeu1WD1IwLYZpTwXG Z4H4c2ksHDiIAfqyZe2juXtSScjVZ/7MYyZhRBmVS7kgGy3HAAIAjzIRw+XCJ+6/wKIW 9Bg2QX27E1XmOaaNiwrV78lheHJb5K+IzTmA4adfwodxAmpW19+1Zf4dJXwnh7gWjoj4 nZ0EwPV3nNHYywNSrt9R6oV6nW8jSh4vUadi45BMx5jq9X1/VCLakV4HXX2PTeQLTLde jvWKeO4CZz3bOADK0HRuF6tOgeSldOso9NxG+84SkY0LB/z69Gk1pNNp4u+hOJqVkoce igHA== 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=B/gmWtUlgRg58hzMukEbhNpMW0tScnEK6rKbkB66S6A=; b=iCIA3i8OF/kMa13FyamN7GMLuXWOcXxb1SlahDP5RpwkKwKxBs1sXS6/3ijQfZOQnz Yep0Ay9BdCK6WTGweFYQn5yp0aDf06Vrwb/XP+o60Zqr/SE/waK+g/PXz3fjmnk1M9wV BPw8rMGWZpdU0GL5bEkUrKAcB1WgXVs8AMlzl2Rnv/VDnewESdBeFN90q+mkaMlqvCa9 g1C+mTWfJuODihAfmLb/ZmG6Nto0ygDHeKEmLIE61kVRqV40NyfUWLJcTbEzqZ4/WOtj mz2RYKzxK4JW9SX6DVMPCwvd3fUwlyJQiTHkVtnKlR9/6EFI/Lg/3Ba6ylE484qZOt47 kA3A== 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 f20-20020a056402355400b0046bd3251ed9si1455862edd.110.2022.12.15.19.14.37; Thu, 15 Dec 2022 19:15:00 -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 S229913AbiLPDNk (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Thu, 15 Dec 2022 22:13:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiLPDNe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Dec 2022 22:13:34 -0500 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793482A951; Thu, 15 Dec 2022 19:13:32 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4NYDh56xhDz4f43lq; Fri, 16 Dec 2022 11:13:25 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAXiNVW4ptjHYxACQ--.50238S3; Fri, 16 Dec 2022 11:13:29 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: jack@suse.cz, paolo.valente@linaro.org, tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linfeilong@huawei.com, liuzhiqiang@26.com, shikemeng@huaweicloud.com Subject: [PATCH v2 01/10] block, bfq: correctly raise inject limit in bfq_choose_bfqq_for_injection Date: Fri, 16 Dec 2022 19:12:21 +0800 Message-Id: <20221216111230.3638832-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20221216111230.3638832-1-shikemeng@huaweicloud.com> References: <20221216111230.3638832-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAXiNVW4ptjHYxACQ--.50238S3 X-Coremail-Antispam: 1UD129KBjvJXoW7uF4xCr1xXrWruF18AF45trb_yoW8Zr1rpa y7K347C34xJF1ruF1jqa1fZFyYqan3Crnrtr13W34Fvryxur92gas2g3y5Za1fKFs3Aw4j va4UWa4q9F1YkaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmmb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28E F7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F4 0EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_ Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc 8vx2IErcIFxwACI402YVCY1x02628vn2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCF s4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r 1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWU JVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x0pimhFUUUUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, SPF_HELO_NONE,SPF_PASS 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?1752338793338701870?= X-GMAIL-MSGID: =?utf-8?q?1752338793338701870?= |
Series |
A few bugfix and cleancode patch for bfq
|
|
Commit Message
Kemeng Shi
Dec. 16, 2022, 11:12 a.m. UTC
Function bfq_choose_bfqq_for_injection may temporarily raise inject limit
to one request if current inject_limit is 0 before search of the source
queue for injection. However the search below will reset inject limit to
bfqd->in_service_queue which is zero for raised inject limit. Then the
temporarily raised inject limit never works as expected.
Assigment limit to bfqd->in_service_queue in search is needed as limit
maybe overwriten to min_t(unsigned int, 1, limit) for condition that
a large in-flight request is on non-rotational devices in found queue.
So we need to reset limit to bfqd->in_service_queue for normal case.
Actually, we have already make sure bfqd->rq_in_driver is < limit before
search, then
-Limit is >= 1 as bfqd->rq_in_driver is >= 0. Then min_t(unsigned int,
1, limit) is always 1. So we can simply check bfqd->rq_in_driver with
1 instead of result of min_t(unsigned int, 1, limit) for larget request in
non-rotational device case to avoid overwritting limit and the bug is gone.
-For normal case, we have already check bfqd->rq_in_driver is < limit,
so we can return found bfqq unconditionally to remove unncessary check.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
block/bfq-iosched.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index a72304c728fc..1220c41fc767 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -4641,12 +4641,10 @@ bfq_choose_bfqq_for_injection(struct bfq_data *bfqd) */ if (blk_queue_nonrot(bfqd->queue) && blk_rq_sectors(bfqq->next_rq) >= - BFQQ_SECT_THR_NONROT) - limit = min_t(unsigned int, 1, limit); - else - limit = in_serv_bfqq->inject_limit; - - if (bfqd->rq_in_driver < limit) { + BFQQ_SECT_THR_NONROT && + bfqd->rq_in_driver >= 1) + continue; + else { bfqd->rqs_injected = true; return bfqq; }