[v3,5/5] blk-iocost: change div64_u64 to DIV64_U64_ROUND_UP in ioc_refresh_params()
Message ID | 20221226085859.2701195-6-yukuai1@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 p1csp809781wrt; Mon, 26 Dec 2022 00:41:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+axx2AupA5MN9Pw8a9KTgAdd0udr4maWj7kATdu/pvSmvsPm8aAfZH7SZJlhI9AXj/FyF X-Received: by 2002:a17:907:c084:b0:7c1:22a6:818f with SMTP id st4-20020a170907c08400b007c122a6818fmr14924976ejc.25.1672044077438; Mon, 26 Dec 2022 00:41:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672044077; cv=none; d=google.com; s=arc-20160816; b=FL7w7VHLXtcvwjniIpDVapgVYH6Nd2JYPXDKzyPTHaaJijdoDnQWkKtbwpk3RQcWKF rpV6zlOmTEGIWUuCilyo7uv1liVh1F4jPBhy7/TW4I8agU4VyaVOLnuAFdOi2WdanMJ7 DQWN+OkInYGvYlkRqiE+Gpu0kp5ueqS1BgboU05+W4A7xpzrmDG2zERE/rZ1pSv2JKuj be75hyZ725Cs1Xr/1TbkuyydIzbJ0mVVySmqsVoGJw8v2XBXTgnW6aDZ9EX6az/65qSf w5vHmuOCqPDhV1yN+qe4fnUZFlCn9/cceH1zkVVOZK+i24Dd7XrobFwzYi/adteNBYf7 jQPw== 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=c3JJSCbS0YyewAbynfpPAQy38EEF8iQBiRuu9pqGO38=; b=RTOze+SSP0tI8RtLbErcRuVo9r1ypcgOICTS01zHAB3dNgu1lPGa3RgiiRCp7X98OC L4lDvbpFd9HDElNLcbV15RlTKzAHyrDKucKOngrDq6yjox9VSlZgjaod1i7c2cuUVtXy EB/h64vbzqZ7SxhWklA6VoC67dE1eoLZ258UOs1EBbICx8qGeN52uWt3fYnvD+uV/oBm ZYt4qMCXNwlVgq+12+QM/tPLT7j0GN3BMzJkGW/NI7HWi+CR+a08fBl/fCP77At7JTER /OoWTfhPYomhWIZf/ehXlI7WuB/2Afpzh1WnXS1ZI6cKr8BsjpqnIbjRYAUTOx5kOJsX mi/w== 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 cs18-20020a170906dc9200b007aedb84056csi9054987ejc.718.2022.12.26.00.40.53; Mon, 26 Dec 2022 00:41:17 -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 S231904AbiLZIjM (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Mon, 26 Dec 2022 03:39:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231583AbiLZIiq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 26 Dec 2022 03:38:46 -0500 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC2B126D6; Mon, 26 Dec 2022 00:38:44 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4NgWQl2ZNvz4f3mSB; Mon, 26 Dec 2022 16:38:39 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP2 (Coremail) with SMTP id Syh0CgBH7eqEXaljOrUjAg--.30907S9; Mon, 26 Dec 2022 16:38:42 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com Subject: [PATCH v3 5/5] blk-iocost: change div64_u64 to DIV64_U64_ROUND_UP in ioc_refresh_params() Date: Mon, 26 Dec 2022 16:58:59 +0800 Message-Id: <20221226085859.2701195-6-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221226085859.2701195-1-yukuai1@huaweicloud.com> References: <20221226085859.2701195-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgBH7eqEXaljOrUjAg--.30907S9 X-Coremail-Antispam: 1UD129KBjvdXoWruw1DtF4DCw47Aw15WFyxAFb_yoWDGFg_AF yFqw10v348AF17uFsY9Fs0vrW29an8JF4ku3sxt3y5A3W7JFWkAws7K3s7ZrsxAFW5W3y5 tF1DWrs2vrs2qjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbTkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2 IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28E F7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr 1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxAIw28IcxkI7VAKI48JMx C20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAF wI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20x vE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1lIxAIcVCF04k26cxK x2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI 0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUQSdkUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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?1753265290378725299?= X-GMAIL-MSGID: =?utf-8?q?1753265290378725299?= |
Series |
blk-iocost: random bugfix
|
|
Commit Message
Yu Kuai
Dec. 26, 2022, 8:58 a.m. UTC
From: Li Nan <linan122@huawei.com> vrate_min is calculated by DIV64_U64_ROUND_UP, but vrate_max is calculated by div64_u64. Vrate_min may be 1 greater than vrate_max if the input values min and max of cost.qos are equal. Signed-off-by: Li Nan <linan122@huawei.com> Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/blk-iocost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Dec 26, 2022 at 04:58:59PM +0800, Yu Kuai wrote: > From: Li Nan <linan122@huawei.com> > > vrate_min is calculated by DIV64_U64_ROUND_UP, but vrate_max is calculated > by div64_u64. Vrate_min may be 1 greater than vrate_max if the input > values min and max of cost.qos are equal. > > Signed-off-by: Li Nan <linan122@huawei.com> > Signed-off-by: Yu Kuai <yukuai3@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Thanks.
diff --git a/block/blk-iocost.c b/block/blk-iocost.c index c6b39024117b..7a0d754b9eb2 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -930,8 +930,8 @@ static bool ioc_refresh_params(struct ioc *ioc, bool force) ioc->vrate_min = DIV64_U64_ROUND_UP((u64)ioc->params.qos[QOS_MIN] * VTIME_PER_USEC, MILLION); - ioc->vrate_max = div64_u64((u64)ioc->params.qos[QOS_MAX] * - VTIME_PER_USEC, MILLION); + ioc->vrate_max = DIV64_U64_ROUND_UP((u64)ioc->params.qos[QOS_MAX] * + VTIME_PER_USEC, MILLION); return true; }