From mboxrd@z Thu Jan 1 00:00:00 1970 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 1C285C021B8 for ; Tue, 4 Mar 2025 14:36:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91F116B0085; Tue, 4 Mar 2025 09:35:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CDCA6B0089; Tue, 4 Mar 2025 09:35:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76F036B008A; Tue, 4 Mar 2025 09:35:59 -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 2CBCC6B0085 for ; Tue, 4 Mar 2025 09:35:59 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4B98980185 for ; Tue, 4 Mar 2025 14:35:58 +0000 (UTC) X-FDA: 83184117996.28.2F6E277 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf16.hostedemail.com (Postfix) with ESMTP id AFFF7180004 for ; Tue, 4 Mar 2025 14:35:55 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EIrBXdyf; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=4lu1rqgU; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=2620yZ3G; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=WGQfANsK; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741098956; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=r2GzlZuQCiYZqEHklmJ416V+7zdr1A6iSNiLyZDc1R4=; b=HCupM0PAJsTBBxc7bKvq0e6Hnbxes21uLRvVcK95KDaEI4Mt+f/Vwy2FhwurTvuxo+d9Ii /icHVJhRtyhJRu5RpZeMqBLWVFsYVCBsfLkbszSfUBCOsA4a1LTQJwhzvcQzDhgqQHDBrv HBDKSKhpdzCyTByiAG1UZR6JhbVpVwk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741098956; a=rsa-sha256; cv=none; b=X/zLmtm2uTytiZS6wvekVAIUTpfi+cUrGpNhBpVa5If2l60F0ylo2gsvIZ2vAL56hrL7MM t0yg3fwkZsMrlFpgXPmAH4d5xm83uaWIZov8wUrC+0vVgdhlpvoMZbSvyPAglW70ZWSS7L rUznle45xvIJJPAKEUr4jv1VcVVXfG0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EIrBXdyf; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=4lu1rqgU; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=2620yZ3G; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=WGQfANsK; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none 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-out2.suse.de (Postfix) with ESMTPS id E44781F74C; Tue, 4 Mar 2025 14:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1741098954; 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=r2GzlZuQCiYZqEHklmJ416V+7zdr1A6iSNiLyZDc1R4=; b=EIrBXdyf89Ms32ytqK+GRB1D2FNW/to7N3h1EtaSrJ8JtZx0yjutbmmJIR+e8FfBw0HJWc 2kQH+M0yMIaS/kPpaJErTQb6luO3kGdJ+dbFKcpsEdqg4D28dcY0JaIdKdYuKQ/dhNykNF p04cL0UAovvoHlfxnTz64dbTwo20Bi0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1741098954; 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=r2GzlZuQCiYZqEHklmJ416V+7zdr1A6iSNiLyZDc1R4=; b=4lu1rqgUjx/Ps5rhwIOlXVbwKBg0UkZCpxYVdl1VwSD/C5enCLx8ENca5cKYRtY4LaK3N3 wP9uJCXhJK0WXmCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1741098952; 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=r2GzlZuQCiYZqEHklmJ416V+7zdr1A6iSNiLyZDc1R4=; b=2620yZ3G8GnJHwTkWcB34dTQH4Cn3ILl1dsqDMjSTFBdOVK6s+Ky0nyzvchnu5mQ1pXzjH KKVBCL8nLxXfP9ydGcEAZwRd0gR8BevdijPZc5THTwgM67nir2/Zc8TI9ZOESAbiN9IvhA XhvuN6qi1ExaHgqV5Pxq6j4UHz5iZQE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1741098952; 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=r2GzlZuQCiYZqEHklmJ416V+7zdr1A6iSNiLyZDc1R4=; b=WGQfANsKGzo4/axnvGNqT/KTsfNZooEIlTrzVRkUAQCDd9gEhxSgdEhgALtAWm+v1qyh1c hNWeuEtZAVJc0qDw== 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 CE2AE1393C; Tue, 4 Mar 2025 14:35:52 +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 FvhPMsgPx2fqMwAAD6G6ig (envelope-from ); Tue, 04 Mar 2025 14:35:52 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 879BFA087F; Tue, 4 Mar 2025 15:35:52 +0100 (CET) Date: Tue, 4 Mar 2025 15:35:52 +0100 From: Jan Kara To: Tang Yizhou Cc: tj@kernel.org, jack@suse.cz, brauner@kernel.org, willy@infradead.org, akpm@linux-foundation.org, rostedt@goodmis.org, mhiramat@kernel.org, ast@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND 2/2] writeback: Fix calculations in trace_balance_dirty_pages() for cgwb Message-ID: References: <20250303100617.223677-1-yizhou.tang@shopee.com> <20250303100617.223677-3-yizhou.tang@shopee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250303100617.223677-3-yizhou.tang@shopee.com> X-Rspamd-Action: no action X-Stat-Signature: b6dugwaw8n6y75m63m8ya9t57ufjextw X-Rspamd-Queue-Id: AFFF7180004 X-Rspam-User: X-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5ClJG6ExlC85NAio3EHOxIDG9l/X4JkRunJlw21BCjVr1My37k4djISEahSTHyVgoGHtMr9H3dmzqIZqalvFA2SohiyaVH0EHdOJILQ3JOEL1Vn8+qJH8Cf3L226oBgDmHgXsjCG3WGglAu0VwJ0F0Ph8bvAls79vlMfFVbnHgG/q6NpAsoODcItHAc/jXee8D9E7QJdOhZtoh7FvywRAEolpqWZSXQO0SuxgePfqiZ8/d/WU3+fsdjgCZF/YhPfzrn3cl176zX9YPSg48aP/rkEPvZ65mJcJKwrbF3FdA+FPnDXH0dycLc0oFIGxW/v+VfLfa2XeHCVhdX2/U9ghTjDD946ufT8tCu/vMWtwxWKfBQFY8zG1SnPuyLuov0neDnYaYH27X17waYcll X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon 03-03-25 18:06:17, Tang Yizhou wrote: > From: Tang Yizhou > > In the commit dcc25ae76eb7 ("writeback: move global_dirty_limit into > wb_domain") of the cgroup writeback backpressure propagation patchset, > Tejun made some adaptations to trace_balance_dirty_pages() for cgroup > writeback. However, this adaptation was incomplete and Tejun missed > further adaptation in the subsequent patches. > > In the cgroup writeback scenario, if sdtc in balance_dirty_pages() is > assigned to mdtc, then upon entering trace_balance_dirty_pages(), > __entry->limit should be assigned based on the dirty_limit of the > corresponding memcg's wb_domain, rather than global_wb_domain. > > To address this issue and simplify the implementation, introduce a 'limit' > field in struct dirty_throttle_control to store the hard_limit value > computed in wb_position_ratio() by calling hard_dirty_limit(). This field > will then be used in trace_balance_dirty_pages() to assign the value to > __entry->limit. > > Fixes: dcc25ae76eb7 ("writeback: move global_dirty_limit into wb_domain") > Signed-off-by: Tang Yizhou In principle this looks fine but one nit below: > diff --git a/include/linux/writeback.h b/include/linux/writeback.h > index 32095928365c..58bda3347914 100644 > --- a/include/linux/writeback.h > +++ b/include/linux/writeback.h > @@ -326,6 +326,7 @@ struct dirty_throttle_control { > unsigned long dirty; /* file_dirty + write + nfs */ > unsigned long thresh; /* dirty threshold */ > unsigned long bg_thresh; /* dirty background threshold */ > + unsigned long limit; /* hard dirty limit */ ^^^ I'd call this dirty_limit to not invent a new name for the same thing. I've noticed the tracepoint has 'limit' as well but that is the outlier that should be modified if anything. Also I'd modify the comment to /* smoothed dirty limit */ to better explain what this is about. Honza -- Jan Kara SUSE Labs, CR