Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1344830rdg; Fri, 11 Aug 2023 19:57:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6WRAz8lQqvEAR2ArhVxQbNItGwY8JaarFs587EFVVG9UzbXamlwqiRN5CnV3afJwoLhHf X-Received: by 2002:a05:6a20:9692:b0:137:3b34:93e5 with SMTP id hp18-20020a056a20969200b001373b3493e5mr3763051pzc.59.1691809035635; Fri, 11 Aug 2023 19:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691809035; cv=none; d=google.com; s=arc-20160816; b=1IAZ8X9LUBn1sq/YnE/FYhCSHrWxKWWMCh2AowdsAT1TPZiRK8/qtCvcriEt8z5Bg7 E5kseDEaIHDMkJJy/RT16MhHOLo4Lfcjc+uGnBsuvrpvM83xFcHY4cAhPvsnkedZhb6z 7cuUuVWp2r+GVwjfU/w7ZGboogz1/TLJulTaV/dPM3/indwHZz7jY5NMBwW3x1O0UQMV ohFZc5v27hD3JnHwVMyxcnmcBkqri3Xl5mCdHcStINarXP19bod1HgkLdD5yLM2Ra5Kf yCq8cDvYd6Yc9W6VBKR2e/0ArrvPkJla+5MEPyDo8g6QXMbe3SQG+4U3n2XOMqDfQZYd p3ig== 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=bTLD/QdYHVpt+4scbNbRrg+8KO9/38zELxI1928BfJc=; fh=XxxYzOshSukWBsx0/2a26FGoVNew0ii/R4prF6CFrrA=; b=hPONIkL3zjMc7Fb8FoLvXNEPMIFK+r4J8VaaX4rpnI+3y3ieJWu2bZpz2sBD2cuTua +dZV2UzazxFqJrsfB0Q16tOJIjnXIXMyhAD+14l2x61o+a3P4ImUtozQeWXQyqkSIazw yMsyUCasY003vZCF011vso9pvxiuoc6qJ8IfwOZAAVhPTh0/z47QmLZ01FPhmrN1MB8N gVa5Ad5ldGUSsrObHGZYZ7d0g1/bK9crrTt2RDIGmeqAbgkTAYIBRrcVRlmf6VmMXg/i eKY9eSXw9aXnegXwjX+isSjey+PAuCQfxTSFACCBOEx/2ZCFEreYZ2iLXV9MfEESGF7I 6g+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=UdPOJ9r4; 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 s7-20020a634507000000b00564ac34c272si4319801pga.558.2023.08.11.19.57.04; Fri, 11 Aug 2023 19:57:15 -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=UdPOJ9r4; 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 S229609AbjHLCeJ (ORCPT + 99 others); Fri, 11 Aug 2023 22:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233816AbjHLCeI (ORCPT ); Fri, 11 Aug 2023 22:34:08 -0400 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F712684 for ; Fri, 11 Aug 2023 19:34:06 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-40a47e8e38dso83191cf.1 for ; Fri, 11 Aug 2023 19:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691807646; x=1692412446; 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=bTLD/QdYHVpt+4scbNbRrg+8KO9/38zELxI1928BfJc=; b=UdPOJ9r4HII7NNEiN5YCqMDeu6BvUbS2vwkDURY9Vi5e0eAEJ7VRD1haOIydI+Ib+7 ta1fdKZPPI1LTFwuiLyNY15TXJfATouhe8oZDdjIU1ZJs5/a6HUe1jv6A9NBzwO8Kez+ 2dU9q0qA6XuEdoQybkOjDZWLqRqBB1YV1JxL8ygLQ1tn17frZDK7VFkRcf+YmkbWHaJY HWs9tbWC3xenui2rP6kX0MFlB60LyMS5NfLN2AFTisRDNP9qM6Snpohl0mnKK57hQh1r HH1mpbjF0mqUoiZO3XlpiVHLkH1vlUIf9Galfiph8Pyhsz1aR38R7jOOLjp7gUKGAIu8 oVSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691807646; x=1692412446; 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=bTLD/QdYHVpt+4scbNbRrg+8KO9/38zELxI1928BfJc=; b=GvClb0qdh16qhYh4V6penmOF7Ibd0XJm2otIuYzOHbxDcMXnmrAC0xtS/FbaiGKTA1 TL9BHUpPt5YM4hgpzH1D9B42/VGhRMywpYD/JzWYjWD8ZfWjNHkqjsekIWPqhYpmYJQq khQMN/syxjxlk9lMyXrp7G8lmwJra1t+0tbZYYdGcmGz/CgXr6c/xgUSUg38EkzECyI3 6xA4qRq+HskZEJlwKP34jHU6psVyA3JTm2k3L6BNupTetm4jMuH5UyZWSe04JnaDhQfM U862CrLx74FeUuMs0qCR3/PflCQ9lUdoOCa/tIe4eKbAcjc2h9YhlXNO8BKahxdIRFci +SGg== X-Gm-Message-State: AOJu0Ywmv04f6ayu9N/Y9mh78wJn5fpNkD+gROh9GUFMx6WFWtm36UAK UCy8kZVC8WXBhYdvlRndB4gRXwAO/K32eFXQEGVsOw== X-Received: by 2002:ac8:58c2:0:b0:403:a43d:bd7d with SMTP id u2-20020ac858c2000000b00403a43dbd7dmr408231qta.4.1691807645900; Fri, 11 Aug 2023 19:34:05 -0700 (PDT) MIME-Version: 1.0 References: <20230706062045.xwmwns7cm4fxd7iu@google.com> In-Reply-To: From: Shakeel Butt Date: Fri, 11 Aug 2023 19:33:54 -0700 Message-ID: Subject: Re: Expensive memory.stat + cpu.stat reads To: Ivan Babrou Cc: Waiman Long , cgroups@vger.kernel.org, Linux MM , kernel-team , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , linux-kernel 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, 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 Hi Ivan, (sorry for late response as I was away) On Fri, Aug 11, 2023 at 3:35=E2=80=AFPM Ivan Babrou w= rote: [...] > > > I spent some time looking into this and I think I landed on a fix: > > > > > > * https://github.com/bobrik/linux/commit/50b627811d54 > > > > > > I'm not 100% sure if it's the right fix for the issue, but it reduces > > > the runtime significantly. In your patch, can you try to replace mem_cgroup_flush_stats() with mem_cgroup_flush_stats_ratelimited() instead of cgroup_rstat_flush(). I wanted to see if you observe any stale stats issues.