Message ID | 20230103095303.2223546-2-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4394083wrt; Mon, 2 Jan 2023 17:57:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvkZChAOWZp/Ydv4zoPiqJotXui/A2cjZZmNJkkgIL1uThQ9abeuPOjXohQILaRriQe/HMa X-Received: by 2002:a05:6402:2482:b0:47a:e008:8662 with SMTP id q2-20020a056402248200b0047ae0088662mr41121481eda.34.1672711064852; Mon, 02 Jan 2023 17:57:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672711064; cv=none; d=google.com; s=arc-20160816; b=zRwMlKytg18roPsavMUjC3SoEZDxM7Uq2JXGs/eJhAewpQ8ZtK71WEdIBNlWsIyxbM 2dszOZ2ptliLx26+7wsSOL7EDWsuA6kAPkFWWKx2sP+UT2+wyZ+dEIG1LgDcC3AtTOfv 1Q70czigbEUiPCuuA1uCOtkZ50lXwvyRRA5tC2jUc0Z82y23kwxCl1D3JlN1/bB4mjCG JdaUeD3ou3uVOaAdgl7Boi2FVYn/63dym57O5DC5j0ikxfNdDdVqrzWFHEGMO2h0zhE0 3efKBvm7DrGHJKJvZzzzAGjHun2Y2Zyhl+SOz6g9NqOMuf7/e7zmbbpw5pAuw2mVMt/P Xa4Q== 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=VKiAbMRIbtHNXVeCxBqN49kSvMl7/Y5eJu2IkOgfXzU=; b=ImrO/g99neyQ1WPJwhEgcsnN7IisPbhbEsV5wPOjsIhf0BYmVKZWOhr4u4Er9r3D7V H+gyCb1nhBUp4wy9b3zeINTFuIiKW80X9KYcrlL7tLZ1tpVGZELyJ4zutFTgS1I0xhen SSjtP6OkujkJluBFdlaVEyu9Oa/6pBaqDKTJkcZUr0oHwON7n5aSk9TuaxnXXtnXbt3z Filbucr5s01e5u41Dkz3YR0rrbufgdlMLDfcJNJezrjuIv4TCpitW69bLnHzUevayeZ5 31D2SNwd5AcU/ncDY2WfhYQKVsiAkxOzu3PBF8tb2iE8x8kpYunQiVbpKpVkeHhFBhzz 6aOg== 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 fi13-20020a056402550d00b00486120b4969si16362602edb.394.2023.01.02.17.57.21; Mon, 02 Jan 2023 17:57:44 -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 S231338AbjACByw (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Mon, 2 Jan 2023 20:54:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232362AbjACByY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Jan 2023 20:54:24 -0500 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A356766C; Mon, 2 Jan 2023 17:54:22 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NmG4T1575z4f3kph; Tue, 3 Jan 2023 09:54:17 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgBHr7LJirNj9wMDBA--.19481S3; Tue, 03 Jan 2023 09:54:19 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: jack@suse.com, paolo.valente@linaro.org, axboe@kernel.dk Cc: hch@lst.de, damien.lemoal@opensource.wdc.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/8] block, bfq: correctly raise inject limit in bfq_choose_bfqq_for_injection Date: Tue, 3 Jan 2023 17:52:56 +0800 Message-Id: <20230103095303.2223546-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230103095303.2223546-1-shikemeng@huaweicloud.com> References: <20230103095303.2223546-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBHr7LJirNj9wMDBA--.19481S3 X-Coremail-Antispam: 1UD129KBjvJXoW7uF4xCr1xXrWruF18AF45trb_yoW8ZrW3pa 47K347C348JF1ruF1jq3WfZFyYqan3CrnrtF13W34Fqryxur92gasFg3y5Za1ftFZ3Aw4j v3WUWa4q9F15CaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB0b4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l 84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUsgyZUUUUU 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?1753964677417535019?= X-GMAIL-MSGID: =?utf-8?q?1753964677417535019?= |
Series |
A few bugfix and cleancode patch for bfq
|
|
Commit Message
Kemeng Shi
Jan. 3, 2023, 9:52 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> Reviewed-by: Jan Kara <jack@suse.cz> --- 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; }