Message ID | 20221222191641.1643117-4-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 c7csp265775wrn; Thu, 22 Dec 2022 03:18:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfAOqpDqHet77Gxe3MjZs6G0xRonS+HfgGGuNWeBrnJHaaEF6piJn5jeH8hq6sNC7skS9K X-Received: by 2002:a17:907:8d03:b0:7c0:d522:decb with SMTP id tc3-20020a1709078d0300b007c0d522decbmr4989342ejc.76.1671707914383; Thu, 22 Dec 2022 03:18:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671707914; cv=none; d=google.com; s=arc-20160816; b=TNvWVL5NnVNqmq9nW/NnfkQR3Dem9xw/8oPkMyeb4m5zHX+D9wuizi+pqjCG2MfVEV 3GP7yfdwv9WWhsns+QfPlRloLlf9tD46bA+gNrUBlEhkDj1cObLCrforZMWtpaZEC11p 3HpVfVjxRtmFaXdItz6Wgn16nmyLZKpabTabgxjChs46miPh574L/qpfQLEZ+fnR66yr 5SaEWbOkfYa8/5JXmpy7rYC91qtOkPiBz9diY0NTjUbjEdHXoCw1YOG/A+cX6AAKKhaF 0z0y+0mTnWMidl8z1LvYg8TnN6Nj84rDY7YJrCVZRO7qOOfiv2MP6c0HNzN9VY5jfkUT +7EQ== 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=4YsAnyP7gsFifnfoSx+vy6U6YNz61wtj1yIQTyO/oMc=; b=C94YzukY46toyDhgknXQ7bFPFHFQAy1Qobr82D5eSw8i9WvCaqMlXovTQrOfRnWWf/ SYw5cRp8UjQzfntFqP8BIqJA4x/hpSnb87+1c9FMY8c60itUnaSDSvxpbCNhiSjEkqA6 dgMJShRt22963R+8LLz/we/fk3N8ckWs/WSYksNcQTgN7+racKcXGB6Dj+z4SbaiwYBA Daiz2C1Jj2c0u8jbvwzEGdYEiyS0vPkp0Kiu13Je81wI0TbmIZbZXz0nh/doNOyC2mgU ezMK2tHPptyJd+Z2bESE2sKIQ6dRfCOSRyUxFeSSbalM62QASK3iGGDyl9uDNURk/A0H bMfg== 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 dd9-20020a1709069b8900b007c158ddfba4si301359ejc.295.2022.12.22.03.18.10; Thu, 22 Dec 2022 03:18:34 -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 S235419AbiLVLRy (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 22 Dec 2022 06:17:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbiLVLRu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Dec 2022 06:17:50 -0500 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBBB1FCE0; Thu, 22 Dec 2022 03:17:48 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Nd78745Ctz4f3p5l; Thu, 22 Dec 2022 19:17:43 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgB3a+nXPKRjMew+AQ--.3596S5; Thu, 22 Dec 2022 19:17:46 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: paolo.valente@linaro.org, axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jack@suse.cz, hch@lst.de, damien.lemoal@wdc.com Subject: [PATCH RESEND v2 03/10] block, bfq: initialize bfqq->decrease_time_jif correctly Date: Fri, 23 Dec 2022 03:16:34 +0800 Message-Id: <20221222191641.1643117-4-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20221222191641.1643117-1-shikemeng@huaweicloud.com> References: <20221222191641.1643117-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgB3a+nXPKRjMew+AQ--.3596S5 X-Coremail-Antispam: 1UD129KBjvJXoW7Cr4Utw1kuw4fJr45tF4ruFg_yoW8AFy5pa 9Fgr47KF4jqFy3Wr1UAa1DGF98Krs09ry7J3W2g392y3yUArnFgFsYkrWYvFWfGrs7Aw10 qw4vqr9ruw1F9FJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBjb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUWwA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2 z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4 xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v2 6r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k2 6cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07js0edUUUUU= 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?1752912798077539711?= X-GMAIL-MSGID: =?utf-8?q?1752912798077539711?= |
Series |
A few bugfix and cleancode patch for bfq
|
|
Commit Message
Kemeng Shi
Dec. 22, 2022, 7:16 p.m. UTC
Inject limit is updated or reset when time_is_before_eq_jiffies(
decrease_time_jif + several msecs) or think-time state changes.
decrease_time_jif is initialized to 0 and will be set to current jiffies
when inject limit is updated or reset. If the jiffies is slightly greater
than LONG_MAX, time_is_after_eq_jiffies(0) will keep for a long time, so as
time_is_after_eq_jiffies(decrease_time_jif + several msecs). If the
think-time state never chages, then the injection will not work as expected
for long time.
To be more specific:
Function bfq_update_inject_limit maybe triggered when jiffies pasts
decrease_time_jif + msecs_to_jiffies(10) in bfq_add_request by setting
bfqd->wait_dispatch to true.
Function bfq_reset_inject_limit are called in two conditions:
1. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(1000) in
function bfq_add_request.
2. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(100) or
bfq think-time state change from short to long.
Fix this by initializing bfqq->decrease_time_jif to current jiffies
to trigger service injection soon when service injection conditions
are met.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
block/bfq-iosched.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Fri 23-12-22 03:16:34, Kemeng Shi wrote: > Inject limit is updated or reset when time_is_before_eq_jiffies( > decrease_time_jif + several msecs) or think-time state changes. > decrease_time_jif is initialized to 0 and will be set to current jiffies > when inject limit is updated or reset. If the jiffies is slightly greater > than LONG_MAX, time_is_after_eq_jiffies(0) will keep for a long time, so as > time_is_after_eq_jiffies(decrease_time_jif + several msecs). If the > think-time state never chages, then the injection will not work as expected > for long time. > > To be more specific: > Function bfq_update_inject_limit maybe triggered when jiffies pasts > decrease_time_jif + msecs_to_jiffies(10) in bfq_add_request by setting > bfqd->wait_dispatch to true. > Function bfq_reset_inject_limit are called in two conditions: > 1. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(1000) in > function bfq_add_request. > 2. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(100) or > bfq think-time state change from short to long. > > Fix this by initializing bfqq->decrease_time_jif to current jiffies > to trigger service injection soon when service injection conditions > are met. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> I agree that initializing jiffies timer to 0 is just a bad practice and current time is much saner choice. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > block/bfq-iosched.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c > index 5a6d9e8c329d..9441fc98961a 100644 > --- a/block/bfq-iosched.c > +++ b/block/bfq-iosched.c > @@ -5491,6 +5491,8 @@ static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, > > /* first request is almost certainly seeky */ > bfqq->seek_history = 1; > + > + bfqq->decrease_time_jif = jiffies; > } > > static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd, > -- > 2.30.0 >
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 5a6d9e8c329d..9441fc98961a 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5491,6 +5491,8 @@ static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, /* first request is almost certainly seeky */ bfqq->seek_history = 1; + + bfqq->decrease_time_jif = jiffies; } static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,