Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp242657rdh; Mon, 18 Dec 2023 18:43:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmO5KHc1W9IAA10J9Ju4ZeKUmsIq95QyzjFoGZPxblPhc4Bw9JbdHWUjUxtf0WfFsPQoq2 X-Received: by 2002:a05:6214:4b90:b0:67a:d711:dffb with SMTP id qf16-20020a0562144b9000b0067ad711dffbmr20279213qvb.48.1702953809707; Mon, 18 Dec 2023 18:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702953809; cv=none; d=google.com; s=arc-20160816; b=A8p1yavdISJ4zPYcgx8mzb5XrDgYJBqq7zg6hrGFjnnQ4CS98cmn3xOHIK8YCFSy5x ZhT5L9MucN4Q0xWwDDC4rey5+COPsnqk8z6gT4+JO1zkFn1lFJSpJIrUpe/W1lQvoGzT M2yFUOhTfud3M5a6gzP6ewtSqxjlJflLHdN9pd2q9IzrTpHN+KH8A2FzTxyy1JFvbdnI icd1wIeoy0LbH4EwgsVY9txdMLPEUXtqR5z5otby8McmlT/xEYyZfsQ3atUS4cVA73HO tbilDOe5yEGgLYv9wvhNKHL7JE8cE7Dqp05qDx7W+AcvVp6TJbf/rJT/sruEY4owdaOL yTqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=JlE4XJUUwV2KLFNjzT//uSZMf3onk5ZKbvoCASYWm4M=; fh=LhRAuR7mnPUf2lm0avoqobx1z6sFYhmPMF/sryImvNg=; b=hDHlkOKNLmP32rJNG/XKVWY2cIC2pczM72le0m8GfjkH2W1Rkh94Bay/XoJ+hFabSV /1skF6Z6alMYC0WyA7rEMUiMTA2vKy1kcQEKsZP+JwEjEQHwxtVD48o4hBDftxbMIyeE 9OwdPQAO88l/E2fFKRNnnTigyd1+niXbF3UCS4itNeGXqoX3loU36+wYHZ4Urn6sMJDf E0tj7WfSGDW8K6/J+C18GmLOVur865Fc9ZnPaG+bBTdrWWbteiYw9NGsLJWStlkrqAHX 0HRv2gPAhbR/dD1w8Sq1KsuS6nchDe5sd/v1MbKi9fOB3unMAyWfSLyL3EpmrUrlFQEG f0aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4610-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e18-20020a0cd652000000b0067a90d3023esi25232140qvj.279.2023.12.18.18.43.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 18:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4610-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4610-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A2661C22DFC for ; Tue, 19 Dec 2023 02:43:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0CF48C15; Tue, 19 Dec 2023 02:42:55 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC095613B; Tue, 19 Dec 2023 02:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R491e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Vyp79GX_1702953768; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0Vyp79GX_1702953768) by smtp.aliyun-inc.com; Tue, 19 Dec 2023 10:42:49 +0800 From: Jingbo Xu To: shr@devkernel.io, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH v2 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Date: Tue, 19 Dec 2023 10:42:46 +0800 Message-Id: <20231219024246.65654-3-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20231219024246.65654-1-jefflexu@linux.alibaba.com> References: <20231219024246.65654-1-jefflexu@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since now bdi->max_ratio is part per million, fix the wrong arithmetic for max_prop_frac when setting max_ratio. Otherwise the miscalculated max_prop_frac will affect the incrementing of writeout completion count when max_ratio is not 100%. Fixes: efc3e6ad53ea ("mm: split off __bdi_set_max_ratio() function") Signed-off-by: Jingbo Xu --- mm/page-writeback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 2140382dd768..dda59b368c01 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -728,7 +728,8 @@ static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ra ret = -EINVAL; } else { bdi->max_ratio = max_ratio; - bdi->max_prop_frac = (FPROP_FRAC_BASE * max_ratio) / 100; + bdi->max_prop_frac = div64_u64(FPROP_FRAC_BASE * max_ratio, + 100 * BDI_RATIO_SCALE); } spin_unlock_bh(&bdi_lock); -- 2.19.1.6.gb485710b