Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp651393rwo; Wed, 2 Aug 2023 01:45:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlH1Pz1MbJafoB640LKD7/4OeG0JvPD6zmmr81uXQRW2zd++xg6R9LmVtEC+csgo12fTfkTN X-Received: by 2002:a05:6a20:430b:b0:13a:6bca:7a84 with SMTP id h11-20020a056a20430b00b0013a6bca7a84mr18151707pzk.44.1690965914236; Wed, 02 Aug 2023 01:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690965914; cv=none; d=google.com; s=arc-20160816; b=HKAQqKBvi+s01T6nw0DMeUxHEOe6P40AXge097DR+vRrSJoOYF/Cv2zPe+/FI700iS pP8+8zEz0pg+lGwCGptq+bkePP7NFPyrwWvh78SL0porqdenImwFZspGgNw6sAIKcVq/ ZET+0Cu4D0nkea5IFQoFUWQ1NDqGxiEVeoV/faHtPlmPb4iSffeA1+jsRprg014Qyvcj EY2odoTlmFT8KBFgC1aAYTpyC57DyeASb8wOl6z4WRUaJ3P5TpqP2GErKt/5u38Z8V0L TofIUCSYvLY/959cHnxjsGUlk8SwPKKtzyhXauEgtLuVPx6OKFA0+4BI6bUKeYvFcCAE hYNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mbfWfMV50AarvWD5inw6HeTT4LJutE3Rh+ubSQUN7nw=; fh=cEFMh3PNd9iVRXfXxHrsoz5nv09ZEIkAvHmeg3TI+FU=; b=bzwUFjQy0fCn7VCBjpq2/R0fFYm3kIKMP0W28psf4JwfiU0q/DiBeiBSDaPZdHt1XA PFCKwQDh03Nr8oCMGp7dQ8LeG8fkqkRIg24vAq1RmxRvS46xM3lwDukfd54bPkty1QK+ jodeuFRTbIvDNK5g6+SeyiRkkdknmGeQ+oKtroS4Q00VrUWXmzUcu0Ibdc98DgbuWf/5 7qeSwmenJaOABDpGvny7q5NGPLCcC25dnSjuykmjZTbVP1WyiWRLjSEe/FE2MnuRWPyk k4vCloUIWNYEoCfvcY0thWORLtH0QdZmZwoRJYFCd7pCI00juw9gFsBZztaIDQfb/ML4 n+aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=A7CXYSrz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a633d03000000b00557953c4263si10517437pga.649.2023.08.02.01.45.01; Wed, 02 Aug 2023 01:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=A7CXYSrz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbjHBIMk (ORCPT + 99 others); Wed, 2 Aug 2023 04:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233849AbjHBIMe (ORCPT ); Wed, 2 Aug 2023 04:12:34 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680CA10F5 for ; Wed, 2 Aug 2023 01:12:31 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-99bcd6c0282so985067966b.1 for ; Wed, 02 Aug 2023 01:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690963950; x=1691568750; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mbfWfMV50AarvWD5inw6HeTT4LJutE3Rh+ubSQUN7nw=; b=A7CXYSrzdB5JXUD+7TCbtjYXqsDsijx1Qdih2Ww0e826+V/wI+JeaBTYRRV/cOs7yL 15UHOQr5FA1Sx0dmaVxVTdw+klq5kFNneo6tqFVCNM4hFZLZCKgk2utxHXdGIvlPgZLa 3dEZUaL+11e8wHIVj5u5stdyVVQM22KYzS/H4AYYeyTqrtkdVY76SxyKBSvcEEXB2sJu QUE2bQoTGJXp4/Gw1pzCfyUMM8pEEBvcN/Xg3y3sJrL56Me5G8XV4GI9Auc269FYZD4V 0WwHsAbVbENXuGd6QRWFeGdXWdSGTGshDHcFjYRwqbkvlUFwGwJKWgwsXKuxzbI0+hWa Iecg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690963950; x=1691568750; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mbfWfMV50AarvWD5inw6HeTT4LJutE3Rh+ubSQUN7nw=; b=fLSe0+Rj+20L0ju8EPfgG6Zbpc1FsY+TUozaDdpjvbzU9ThVUgqKFrY/CA3kkMHq1D eYIywfet9Q/45gHPZLrtvT4C3e0CX6c1yDHqG34ent6iav+XqksPJQAQfFDs06HErUFP 3fqA4FRA0mE45f61e86tq4jDjObwsslIXhLPWjVUZh729/ykpW6utkNC+LsO1+nhGAl2 djq/ytJN5/mu9XazTY9Oge3liAlgYLitP5yqzDk0JR5mYMCJofSDQOUqdR+50JZiy01P wrvH7CFnmiMYbQ5pRCLeMLAbyi2Zi9rql/viZB160tGjuPYvQkJl6sWkR3bqRV2BQW36 QNUw== X-Gm-Message-State: ABy/qLY7UBQiVqXUI+5InyuLxMl5E2QSVZ+L6CVNjx/zpnYl5ednx9zI quTTik5YxdboQ8peKycGpEpf89sAoJW/vShkMHvkPg== X-Received: by 2002:a17:907:7618:b0:977:ecff:3367 with SMTP id jx24-20020a170907761800b00977ecff3367mr4685802ejc.40.1690963949700; Wed, 02 Aug 2023 01:12:29 -0700 (PDT) MIME-Version: 1.0 References: <20230726153223.821757-1-yosryahmed@google.com> <20230726153223.821757-2-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Wed, 2 Aug 2023 01:11:53 -0700 Message-ID: Subject: Re: [PATCH v3] mm: memcg: use rstat for non-hierarchical stats To: Michal Hocko Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 2, 2023 at 12:40=E2=80=AFAM Michal Hocko wrot= e: > > On Tue 01-08-23 10:29:39, Yosry Ahmed wrote: > > On Tue, Aug 1, 2023 at 9:39=E2=80=AFAM Yosry Ahmed wrote: > [...] > > > > Have you measured any potential regression for cgroup v2 which coll= ects > > > > all this data without ever using it (AFAICS)? > > > > > > I did not. I did not expect noticeable regressions given that all the > > > extra work is done during flushing, which should mostly be done by th= e > > > asynchronous worker, but can also happen in the stats reading context= . > > > Let me run the same script on cgroup v2 just in case and report back. > > > > A few runs on mm-unstable with this patch: > > > > # time cat /sys/fs/cgroup/cg*/memory.stat > /dev/null > > Is this really representative test to make? I would have expected the > overhead would be mostly in mem_cgroup_css_rstat_flush (if it is visible > at all of course). This would be more likely visible in all cpus busy > situation (you can try heavy parallel kernel build from tmpfs for > example). I see. You are more worried about asynchronous flushing eating cpu time rather than the synchronous flushing being slower. In fact, my test is actually not representative at all because probably most of the cgroups either do not have updates or the asynchronous flusher got to them first. Let me try a workload that is more parallel & cpu intensive and report back. I am thinking of parallel reclaim/refault loops since both reclaim and refault paths invoke stat updates and stat flushing. > > [...] > > > It looks like there are no regressions on cgroup v2 when reading the > > stats. Please let me know if you want me to send a new version with > > the cgroup v2 results as well in the commit log -- or I can just send > > a new commit log. Whatever is easier for Andrew. > > Updating the changelog should be good enough. > -- > Michal Hocko > SUSE Labs