Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2128348pxb; Thu, 4 Nov 2021 14:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1AIPxUqSyJjZSXQGZwTizYDrokEBxjc0riGcUUO5Ppu9wAug7F2AoANemF5GlGUq0pNLH X-Received: by 2002:a17:906:2ad2:: with SMTP id m18mr64466569eje.64.1636061466027; Thu, 04 Nov 2021 14:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636061466; cv=none; d=google.com; s=arc-20160816; b=iXBm0nrAecBU7vGFuqZz3yjuVPuR81/D+E3DFH4NZycJo2yZi9R2AaWDC+/BIBSk4U 7TD6XLR9ouBbuWEHo01hQtufSyeyp7yNFBi45M17mhNRYTEiPIrQZtkktORdsOcT71WQ oVNgacjpdc7eYaqwnBXWTog80z5DKIXlArC1CGRjFGOz7ajxfznRlCkXwAeQCi9ZAKr2 sTCFKrja4XpKzmlDYiS5BPLTShGtw8pnobeYXHGo7As8HUmqGmaKNdl/4Amws/unRu7v urNc5JQ9grRWVMUMFe3HvtI6r2hbKAF+61ioaGdgjX8wSWcI2mizob8yxTEun7mbHxSD pHzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZLX549ffHbXddcmsFdpgn+oRC0pUvD27x/Wj9+KVD1s=; b=PeJAMTnSkW7CKBxxqDE6mM/Qmz4b0tF24vJOnXUFLqPUArVidNhWg5pjchp48XaL1U PPUeY2JnXVQ40PN7a7vhpj6S406RE3TxJB1IOYKFTjCzFVTO7i7zDs76qhjTdwnzqsvq LKw9tBcs+ANpH6YQWNXo66lsM25IE9MC1Ob4lfSmlje6sLJN2WwgWmas0hjKIn/gSCOU RKGaUkeEhqWcc8FkjfyDgHNSPqHUPG58JfY+w5SX5YmAWyNEKkfaqtqMSWR01RcGeE+c KdxnBz2duI/cHdg0AnlNUIZAfAB6bn7KR7OudGaz2WLdzsxWZOcrvs4zMIySRErMmRWT bsDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=W49zmmuO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si14622897ede.586.2021.11.04.14.30.36; Thu, 04 Nov 2021 14:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=W49zmmuO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231857AbhKDVae (ORCPT + 99 others); Thu, 4 Nov 2021 17:30:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbhKDVac (ORCPT ); Thu, 4 Nov 2021 17:30:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D14516120F; Thu, 4 Nov 2021 21:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636061274; bh=i9bMCMWDq8qHtNLlg+d8d+bhz1QaRU5Lfr6G49bzhRs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=W49zmmuOtuvil1F/FB/CNc96Rs+frDTFSY/kBa0OMbA6zracevDH8JNrTJpvcMOLJ zvojXYCv8MRxejfqR2v9CDScI5Y2DFrHbUs1yDrF90ozZMDEr0IIqWVxkB4rapy9Xg GY7j0KWCbsCGMfp/9cLEdNiwLY4e+eYMvtWFt274= Date: Thu, 4 Nov 2021 14:27:51 -0700 From: Andrew Morton To: Shakeel Butt Cc: mkoutny@suse.com, cgroups@vger.kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org Subject: Re: [PATCH v2 1/2] memcg: flush stats only if updated Message-Id: <20211104142751.5ab290d5cf4be1749c9c87ed@linux-foundation.org> In-Reply-To: <20211014163146.2177266-1-shakeelb@google.com> References: <20211013180130.GB22036@blackbody.suse.cz> <20211014163146.2177266-1-shakeelb@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Oct 2021 09:31:46 -0700 Shakeel Butt wrote: > Hi Michal, >=20 > On Wed, Oct 13, 2021 at 11:01 AM Michal Koutn=FD wrote: > > > > On Fri, Oct 01, 2021 at 12:00:39PM -0700, Shakeel Butt wrote: > > > In this patch we kept the stats update codepath very minimal and let = the > > > stats reader side to flush the stats only when the updates are over a > > > specific threshold. =A0For now the threshold is (nr_cpus * CHARGE_BAT= CH). > > > > BTW, a noob question -- are the updates always single page sized? > > > > This is motivated by apples vs oranges comparison since the > > =A0 =A0 =A0 =A0 nr_cpus * MEMCG_CHARGE_BATCH > > suggests what could the expected error be in pages (bytes). But it's mo= stly > > wrong since: a) uncertain single-page updates, b) various counter > > updates summed together. I wonder whether the formula can serve to > > provide at least some (upper) estimate. > > >=20 > Thanks for your review. This forces me to think more on this because each > update does not necessarily be a single page sized update e.g. adding a h= ugepage > to an LRU. >=20 > Though I think the error is time bounded by 2 seconds but in those 2 seco= nds > mathematically the error can be large. Sounds significant? > What do you think of the following > change? It will bound the error better within the 2 seconds window. This didn't seem to go anywhere. I'll send "memcg: flush stats only if updated" Linuswards, but please remember to resurrect this idea soonish (this month?) if you think such a change is desirable.