From patchwork Tue Dec 19 14:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 13498364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 103E5C41535 for ; Tue, 19 Dec 2023 14:25:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 946738D0005; Tue, 19 Dec 2023 09:25:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 87E6E8D0001; Tue, 19 Dec 2023 09:25:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F7DC8D0005; Tue, 19 Dec 2023 09:25:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 603BA8D0001 for ; Tue, 19 Dec 2023 09:25:19 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3BE371C0E44 for ; Tue, 19 Dec 2023 14:25:19 +0000 (UTC) X-FDA: 81583790358.03.50DEFC0 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by imf13.hostedemail.com (Postfix) with ESMTP id 36AF12000B for ; Tue, 19 Dec 2023 14:25:16 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of jefflexu@linux.alibaba.com designates 115.124.30.111 as permitted sender) smtp.mailfrom=jefflexu@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702995917; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J3pKbu3HhrY4DO26wm/WpsAbM/NbvtzKruj1jmFjyMk=; b=ECwg97RUtZct3kbpaDK+ANKHQEFoQ3rF0TaEzd/O6or6hFOfi0vnMcZP6medvknPF/IAfA DxEBLebKEfDjv9skoXsKASV+hx8QoGcLG/smMLPpRd2E5IyBpu5uEqcH6NynyUvFvw6c7g rmm7slqnieu5yFPI2PijilMcnnAmSCY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of jefflexu@linux.alibaba.com designates 115.124.30.111 as permitted sender) smtp.mailfrom=jefflexu@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702995917; a=rsa-sha256; cv=none; b=oXYsx7pFrUCxJBmCYIvra2OeGVQ1vsho1cX20tQP3coUtVkoY5HR+nyWQYtnYMpPYs3ppS nUmc96YfFkFyV18AycJ/R5NTDnh3DT9+KSzHL0FMz7gG86ub15ygyNwmdQ9v9wHVxVrJob qEjhC6VRXRTZyk1bZ9nlI/T9ydodAJ0= 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> MIME-Version: 1.0 X-Rspamd-Queue-Id: 36AF12000B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: wwttx9diq46crew1ycqent33xuw3pfo5 X-HE-Tag: 1702995916-382862 X-HE-Meta: U2FsdGVkX1+wGYmuCHI5L58BnV78nZzoK5lG3/dyQ5bjIDUhJhJo9FILObGFJHPxgP1XCMZA1A5FDABxK5y5FRvFo/HFtWFVYM2lK24rgBZa6JZoaMvshXXvKocZgpt5WIsKbjkK23QC7UWCiRJrHdcdVbGS+0WqwlOghPFJuyTOZ/YSU3KkY5Y3A66AJlWN3PfJPI251WWOvL2AEKJ1ME9MX7NrJn/6WSReRI9Jr1Pn0NLMjMJsziBKfgPMhTNnNVDIeUnH6TRa9M7gy5i9xvi7QZLfVeYE/UE45n2Db0BM8pPcNaAstjQfOujA/aC4U4qEeceSWp5ZWp2u9j9GjAq77X7vYkUXzKL0Dhp2YxzjmPE7zanGUW/Lfeyfdjw38MpSJrCOQaNCsndbIJi0aNiNSHPQ3ZPQKY0uoRQ5BoiDM+YUCwo2Wvoyj9FXPnlxDmRNCl/C/eW+ShkQ/awVQAnnLT0yYvcWe0CI8CmktiIpSZIpewMYDzAnQsHI4zFgdglTlV7nrkvOmjzwijbLwlBeL1bk4irXBUtIvhwvqErhU0vav7PdRf/o2GLpj7drwN2ATLGFtzbvx1UTJdcJCGqPdi3tPwrTgNv0g4HLGPKElaC6YGH+22wU4Yt85j1Q1JO/y7ZBH1GyjFFP3h7aFn7ce5CXUaS858zlnTNbgvhx0Q6K7HWcoTScE7iX9pCIh/2y4ieStxeNELFBIdNKd0DLdamfIcEGW0sWRHoQQtSu3UaXYgjtdAEcEplb0XztD7chFT/nXY+UZb5v47+EsDFGU0Dhs2wzsNjT4hDDnxEb9begBCTHR405q7j8xKYoY+Szg2g26B939f0WfbyF5hRUxpFWp2oR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Reviewed-by: Jan Kara --- 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);