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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D783C433F5 for ; Thu, 4 Nov 2021 22:09:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C096C6124A for ; Thu, 4 Nov 2021 22:09:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C096C6124A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 233016B0071; Thu, 4 Nov 2021 18:09:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E2886B0072; Thu, 4 Nov 2021 18:09:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D1EC940007; Thu, 4 Nov 2021 18:09:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id F1EB06B0071 for ; Thu, 4 Nov 2021 18:09:32 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id AD3DB182CCFC9 for ; Thu, 4 Nov 2021 22:09:32 +0000 (UTC) X-FDA: 78772640184.16.922753D Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by imf27.hostedemail.com (Postfix) with ESMTP id 0965570000AE for ; Thu, 4 Nov 2021 22:09:31 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id g29so717451lfv.4 for ; Thu, 04 Nov 2021 15:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ODhjY+JjkYpUpFv09zJB9aBghMhLyhOS/H4FgA78QU8=; b=JHVS8Ow1HVeUipVMLT11yHlvnxUVD2nceGQ5AKOw+p77/NeUjmgxc/oFiHSOxrbrpy Is/GwTZWZuoxrsC80rpbv/2Y8AaAq/cFI3MhtzhNbqZ2SeltjziPfSnhXJUAjXXzuneh 06pZbRk62NEQyFwifnDmYhpdXaj5WIbqygNh018AToErjr1rpOAMHzMlLBgBnFYYWmsM n3epCtFUKoO951mcxkIQfDT2Ez/LVEgPNqs68kV3L8jvbEOgor4J5JFG089J8+xV4Vwu lLYjqTpUdsD5O3nUSnHNlw2U5elxiK5a1njy2kFnY+pVVBcnd9VbIH0GJWibXuXHxCHT qOTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ODhjY+JjkYpUpFv09zJB9aBghMhLyhOS/H4FgA78QU8=; b=5p3iGcbrbYi+01xzXLHu4tyLHqnMvy4s/StpP3zsELS69ITY45LjrM9qdl+3cltebv 4vCbtI5ZLLFgeOTVO/L+nXhMdRZ7unUFjKOcDGW2dSRd1rCP2ZdOw3PaPFagGvp1+QN4 3DvVpBxx5FiYFujcd+3T/nJGHDNeBttqOCDRKX1G8y80CWDoLH7o6KxWgtsGwhYDNSOx tbXoq5RU6W3FiheqLWI3vGTgyiHnrxz/Ok0ydFUZZ0YiSN355/pCdmOSqJYIHqACVYDx 7TVWUBLaM4h5XWeMnllwGy+oMqE6LTrDHvsCOlbQwE4tbZ3PsLZdu5oqxpBF/iyx4iTP mALA== X-Gm-Message-State: AOAM530wPTmKXMW8O5OTCnW2KQhamrMMMdryz0azWnNhDNvlLazNlAji 8OhijfFmoiZAwt4hu2mXy1fuR7uk7KUoFC600zkhig== X-Google-Smtp-Source: ABdhPJyCySNfwv75WoGWFSPYJQ9LqbdrCPdqJpHKt8D7zE+l3mpEMxyt3SFexC6VWMES75d4HEuprj4x5ybvSm5jjD4= X-Received: by 2002:a19:740f:: with SMTP id v15mr29475880lfe.184.1636063770123; Thu, 04 Nov 2021 15:09:30 -0700 (PDT) MIME-Version: 1.0 References: <20211013180130.GB22036@blackbody.suse.cz> <20211014163146.2177266-1-shakeelb@google.com> <20211104142751.5ab290d5cf4be1749c9c87ed@linux-foundation.org> In-Reply-To: <20211104142751.5ab290d5cf4be1749c9c87ed@linux-foundation.org> From: Shakeel Butt Date: Thu, 4 Nov 2021 15:09:18 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] memcg: flush stats only if updated To: Andrew Morton Cc: mkoutny@suse.com, cgroups@vger.kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0965570000AE X-Stat-Signature: scybdaox18gj7n46obdw87xbsj4smkrw Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=JHVS8Ow1; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.45 as permitted sender) smtp.mailfrom=shakeelb@google.com X-HE-Tag: 1636063771-939346 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Nov 4, 2021 at 2:27 PM Andrew Morton wr= ote: > > On Thu, 14 Oct 2021 09:31:46 -0700 Shakeel Butt wro= te: > > > Hi Michal, > > > > On Wed, Oct 13, 2021 at 11:01 AM Michal Koutn=C3=BD = 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 le= t the > > > > stats reader side to flush the stats only when the updates are over= a > > > > specific threshold. For 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 > > > nr_cpus * MEMCG_CHARGE_BATCH > > > suggests what could the expected error be in pages (bytes). But it's = mostly > > > 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. > > > > > > > Thanks for your review. This forces me to think more on this because ea= ch > > update does not necessarily be a single page sized update e.g. adding a= hugepage > > to an LRU. > > > > Though I think the error is time bounded by 2 seconds but in those 2 se= conds > > mathematically the error can be large. > > Sounds significant? Yes it can be. > > > 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. > Yes, I will follow up on this soon.