Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7856532rdb; Thu, 4 Jan 2024 09:41:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsnDQ0rYKEbPQj+Ked8Y0hqW7C/+28VbXfrjRzODMETEAOu0Hqxb22MvIt7UR2Mhj/wBMq X-Received: by 2002:a05:6402:2cd:b0:552:e0f3:4f3b with SMTP id b13-20020a05640202cd00b00552e0f34f3bmr538241edx.30.1704390082924; Thu, 04 Jan 2024 09:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704390082; cv=none; d=google.com; s=arc-20160816; b=t+ePXr6giUrXPtQGEom2NmDKwiywYkFp0IW5GvQLdt4qnR2dhCje+y4j/XqWZgEFY7 6wemsqiWFtzI/78NDjyCW+tKhQeofzqGgNXekK+2FxqWKNB6xQnYvywVjB5UR1LTPL3G ZiscqYzHB8EmJSiBvBQ0R3/f1NmL9gcPB4Y9cdqi+hJkT/jRgcy8SRixQ0x1X1ndF8yW SWojmYOMXzBDuLXnTsToe8bI/HyEZ3wBpqoTWXd19N9jStjDFfP2HsukybTSYV2ao02q 0gCCdGFJyEtNSsH6MqP5iBZ/TbfKj98F/zrOfUqjmnVv418SEj7crl91oVZxL0MNOejV 2ouQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=12e9jUxfm5hixJE8HJKUVsReJEnWe7uObiTgEXpBrgI=; fh=5lKwdQYPCMn3ndBs/aQQlse39yzpyVwwrqbc0NbI7fI=; b=FmFJ/7Z8xcRWVmDXrakIovlrEefhe91sc/verXfRogO3Z2/DGTiidw3kSXMy5RvYJM NyjbDVt4Nropz2aawZqEh22sRYs/spKe2tecOzq/8hneloKiOFEJ7cNr40ITmoQ8A1Ns EcLnNV6GTXHsBpDpiB5EL39Zccme8FJNvZem/z+ls0jUlGqurxn7T5mGi7T66QWdL9Rw NJzmlRlJ4ntDogsHsFKomzXZDQj5SBjT44lOJI3yKB9Gn7El2lG7wBAHvnnLl6ADkIzW YkVmC8tRcfDzrCBjyL/KLlkAhlF7N9FUBH/7cm8zndAq7O1u7ZBMfnyMcGlIkacC3xkE Kx6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WO5Etiid; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WO5Etiid; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel+bounces-17048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17048-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v26-20020a50955a000000b005537fc22bffsi13553267eda.590.2024.01.04.09.41.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:41:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WO5Etiid; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WO5Etiid; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel+bounces-17048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17048-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id A29851F230FA for ; Thu, 4 Jan 2024 17:41:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9EB328DA6; Thu, 4 Jan 2024 17:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="WO5Etiid"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="04dZR2xX"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="WO5Etiid"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="04dZR2xX" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60A7286AD; Thu, 4 Jan 2024 17:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AC7A3220E7; Thu, 4 Jan 2024 17:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704390061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=12e9jUxfm5hixJE8HJKUVsReJEnWe7uObiTgEXpBrgI=; b=WO5Etiid/pU3xN8w8vhjx90jdz7GK/ncX4XV1mlb233QI1S/lio8krvCVsGscJW5PhPqvc 0bVnkl2pnwFmQ2i+GCN2xetg/g5gITNjKHu9pnNxQQPA18gqw3C/lCw4n8iRrd2HpDtQ6W c/wd2rNKB/YBMJE6eX6KeMEDSQ9MP8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704390061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=12e9jUxfm5hixJE8HJKUVsReJEnWe7uObiTgEXpBrgI=; b=04dZR2xXWmGMLLO5uuzGGktjAp99J+iHO8dZj9tgJRDaB+Hb3Cn7PhnIBpWBGRpSB76B2T ydTyey72oz3kwXBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704390061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=12e9jUxfm5hixJE8HJKUVsReJEnWe7uObiTgEXpBrgI=; b=WO5Etiid/pU3xN8w8vhjx90jdz7GK/ncX4XV1mlb233QI1S/lio8krvCVsGscJW5PhPqvc 0bVnkl2pnwFmQ2i+GCN2xetg/g5gITNjKHu9pnNxQQPA18gqw3C/lCw4n8iRrd2HpDtQ6W c/wd2rNKB/YBMJE6eX6KeMEDSQ9MP8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704390061; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=12e9jUxfm5hixJE8HJKUVsReJEnWe7uObiTgEXpBrgI=; b=04dZR2xXWmGMLLO5uuzGGktjAp99J+iHO8dZj9tgJRDaB+Hb3Cn7PhnIBpWBGRpSB76B2T ydTyey72oz3kwXBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9D89A13722; Thu, 4 Jan 2024 17:41:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kuyQJq3tlmWQcQAAD6G6ig (envelope-from ); Thu, 04 Jan 2024 17:41:01 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 0C27EA07EF; Thu, 4 Jan 2024 18:41:01 +0100 (CET) Date: Thu, 4 Jan 2024 18:41:01 +0100 From: Jan Kara To: Jingbo Xu Cc: shr@devkernel.io, akpm@linux-foundation.org, 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: Re: [PATCH v3 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Message-ID: <20240104174101.oax6zbdhy4v5u4bf@quack3> References: <20231219142508.86265-1-jefflexu@linux.alibaba.com> <20231219142508.86265-3-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231219142508.86265-3-jefflexu@linux.alibaba.com> X-Spam-Level: X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=WO5Etiid; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=04dZR2xX X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; URIBL_BLOCKED(0.00)[suse.cz:dkim,suse.cz:email,suse.com:email,alibaba.com:email]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[9]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email,suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.99)[99.95%] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: AC7A3220E7 X-Spam-Flag: NO On Tue 19-12-23 22:25:08, Jingbo Xu wrote: > 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 Good catch. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > > -- Jan Kara SUSE Labs, CR