Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2139810rdb; Tue, 3 Oct 2023 11:23:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQwyzQVX5CgyAe+Be1SINZMP0Na7aHd7CCxkYbvKWUuWdgtl1jbaUMyDEDasWqSAIIUh5W X-Received: by 2002:a17:90b:1989:b0:269:851:4f00 with SMTP id mv9-20020a17090b198900b0026908514f00mr112367pjb.35.1696357389263; Tue, 03 Oct 2023 11:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696357389; cv=none; d=google.com; s=arc-20160816; b=VUEgwCJfY18d6wxaXXQnnAP74pHOMmrXqwQoN/y8ZnO7qWDYMTgu16JEizQeOVF5M2 MCfpKONjbFP3XhrVVXKNJ4G5bx2jowXY+znKIVu4y0YCIieKD7n7Dja4toA+8kME9/Sk jPZJTGtRBa3iBHIrl85JgljF+PHsqLgtIkOzlCNNnf49dswuJY/CfoimDHjZ8NxqHrNU w1Sh4mcCXnci8l39N4zzAeeAHLi8l4p9jyngE9zEFtvFkLrFyOdLlH7htKgbtfUEmJQx +wLfsCyU13/tBY7AR/CDjXnUlGPvckL+Ac0G93tAIXH/f1k/CDZ0zVN2E+BokO05WAoA Rd9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=snq5RhSGYHBHi8BPd1bP7iYx3B/gYWxBD5InsOqzHAc=; fh=kbRWIM8ZOVSybhyeGCsE16fd1GzY6dINIO+J3v/yDJc=; b=OgcAFm8uy00ys+fyvFAd0ReEfNXymK9G71f68mQqIwNOAdYgaFV8gKnyyjH5Kllq7K Mxjld/WkVsMjVbxgtwM/ljeJLY7QSf0qHzMGxfzMw/jP78qkOq/n/rzJCCu90f4WLil+ qrzXuBh4foVqeU13+NJJU0gmTQEoqZugDeMMjyd5BZxMd7brCIOKIQkgZh+ketfZ+3Ol B8SNlSoECj4+tEl8x0mDfMTxPKrarGq7reyMkb/v4sXmDnZ/zwNfKElhzFQ1ebYZA5w1 rPkf5Fo2EzD+Xr3t5oiuTzy5PFqjnkDomrK+mHeYr5Dfx4zlKUJneDycXaqZH0IdXmLY onww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=FbmB+coq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id kx6-20020a17090b228600b002773294d636si10521241pjb.103.2023.10.03.11.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=FbmB+coq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7D6F08177E01; Tue, 3 Oct 2023 11:23:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240754AbjJCSWz (ORCPT + 99 others); Tue, 3 Oct 2023 14:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231667AbjJCSWz (ORCPT ); Tue, 3 Oct 2023 14:22:55 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0373183; Tue, 3 Oct 2023 11:22:51 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 13BB021850; Tue, 3 Oct 2023 18:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696357370; 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=snq5RhSGYHBHi8BPd1bP7iYx3B/gYWxBD5InsOqzHAc=; b=FbmB+coq881p/BKfyHH0tppRCI9xdBQvqZTf6VUI5qSAATOdlfsaAvPJZvUso32TKwph7M zMw+zZX3DdgxU0FUsYow8ISINzOevV5RYZH+ZdchhBSev1UEGLWUMhekrjeCe47dQXSEQq XsqsCZVz6N23A8SAD6BJ6RUAkt4yRIs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D95A7139F9; Tue, 3 Oct 2023 18:22:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bMxMNPlbHGWvOwAAMHmgww (envelope-from ); Tue, 03 Oct 2023 18:22:49 +0000 Date: Tue, 3 Oct 2023 20:22:48 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Yosry Ahmed Cc: Andrew Morton , Shakeel Butt , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] mm: memcg: normalize the value passed into memcg_rstat_updated() Message-ID: References: <20230922175741.635002-1-yosryahmed@google.com> <20230922175741.635002-3-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xld3q657sg75bexy" Content-Disposition: inline In-Reply-To: <20230922175741.635002-3-yosryahmed@google.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 11:23:06 -0700 (PDT) --xld3q657sg75bexy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 22, 2023 at 05:57:40PM +0000, Yosry Ahmed wrote: > memcg_rstat_updated() uses the value of the state update to keep track > of the magnitude of pending updates, so that we only do a stats flush > when it's worth the work. Most values passed into memcg_rstat_updated() > are in pages, however, a few of them are actually in bytes or KBs. >=20 > To put this into perspective, a 512 byte slab allocation today would > look the same as allocating 512 pages. This may result in premature > flushes, which means unnecessary work and latency. >=20 > Normalize all the state values passed into memcg_rstat_updated() to > pages. I've dreamed about such normalization since error estimates were introduced :-) (As touched in the previous patch) it makes me wonder whether it makes sense to add up state and event counters (apples and oranges). Shouldn't with this approach events: a) have a separate counter, b) wight with zero and rely on time-based flushing only? Thanks, Michal --xld3q657sg75bexy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZRxb9AAKCRAGvrMr/1gc jo8EAQCHso22KOo01FrMO5y8vuJbtEnROzr9y7VGM8DBcnx6QwD6AmbPbTKOMvE4 9AN5W+sZ+Ge4/lZ/E+DTn6TCAA+2KQc= =UQA2 -----END PGP SIGNATURE----- --xld3q657sg75bexy--