Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp534786rdh; Tue, 19 Dec 2023 06:28:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvFQSPBxwOieZiHKboVlyv49p86IiNYGOX/J1Uh5WbVohJehY0HPcYOJZ6alVhd+/UwGpK X-Received: by 2002:a17:902:f2cd:b0:1d3:492c:faa6 with SMTP id h13-20020a170902f2cd00b001d3492cfaa6mr1237737plc.48.1702996092045; Tue, 19 Dec 2023 06:28:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702996092; cv=none; d=google.com; s=arc-20160816; b=CLPaKV5cjXDniXMEqBbyc45e7ih/g6LpQ9Vy/1rabhBYmFQSx6Nyv6+rpV9LIxpDS+ 470nFd4xiCGWFKL0VUcIa5YQGm3rynVxnGZsXzlINlGMbcWzO0VsBjAmFIABxkFgJsF5 McPjOiuF7EMe6J7I8onFGVko573BpwoJa/h91Q+J3D+y1xabpk+C72FtfLgtWpwjF8hS LLxZXFtNnJJg7fnvmzQpFH0CjE9qQ8+xnpsdC7stU+qQGPVp2UzcNELlA+pvgaE3IO83 2AnM1KejAXCiyzA+qIxKfzaQGfb65u9KMqLcoZUSaySjhjXCII8CGE2dSgNrqFYn0kC8 pYLg== 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=J3pKbu3HhrY4DO26wm/WpsAbM/NbvtzKruj1jmFjyMk=; fh=e/E5Z5uKag/MmdmVaHa/8oiovY/7OlXJBsHI95ofI58=; b=FwW0Bf+P+SXsAzxnNgS1+Ad9x/UNQIKvNNAm+03RQJw3rmpki9On5YS99/LCdm7kY5 cNMj7VGkAHHNDQa/8ZmY7c93d/35C0+yzhCb22HrehDyuH9zomVH3LKR/uegkjFMWzyh 9G9+dU4+ZgeZjh3oT9V1HmlgARopuQnn+/vCk3ip8bStu+bHPeLRb3/9vOZQFs1uIgHg jqBRQEIxT11tB0OA23iepkhLxDriEEj7+NF6ArW9FNJDWMX9PcfkjTapgHBDw1CeL/74 BdXJ0hk46pPU+q2oY0pMUsY54UYnSCAO1NEsnQTezDZrtdoS93caRAHfXa9n0YFwbDE7 bplQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b27-20020a63715b000000b005cda5e4a862si3030205pgn.258.2023.12.19.06.28.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:28:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5353-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6AAF8B25265 for ; Tue, 19 Dec 2023 14:26:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDF931CA8A; Tue, 19 Dec 2023 14:25:22 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (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 CBA161C6B2; Tue, 19 Dec 2023 14:25:19 +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=01201311R771e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Vyr60qx_1702995911; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0Vyr60qx_1702995911) by smtp.aliyun-inc.com; Tue, 19 Dec 2023 22:25:12 +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, willy@infradead.org Subject: [PATCH v3 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Date: Tue, 19 Dec 2023 22:25:08 +0800 Message-Id: <20231219142508.86265-3-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20231219142508.86265-1-jefflexu@linux.alibaba.com> References: <20231219142508.86265-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..05e5c425b3ff 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 = (FPROP_FRAC_BASE * max_ratio) / + (100 * BDI_RATIO_SCALE); } spin_unlock_bh(&bdi_lock); -- 2.19.1.6.gb485710b