Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp575123rdg; Thu, 12 Oct 2023 14:21:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEItWLJpHYt0ZBVG6zbMDknD3/o6ySSA205Z7ItOJStwf+044vAfIDPAtCCSZKH7AsJsVJI X-Received: by 2002:a05:6e02:1bec:b0:357:4535:c8c with SMTP id y12-20020a056e021bec00b0035745350c8cmr9187833ilv.0.1697145697554; Thu, 12 Oct 2023 14:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697145697; cv=none; d=google.com; s=arc-20160816; b=xYvJD0aASjiWSN2MuaCturJZAs/Z6E5iNtrK/xkQL/ttUdf+7B3Ll0If1Fp++JBTHW MYSNKCFRLRlp/uM0zYDHRFuxt66ZlDHNFk4RWORTlYwm0Z1BfnlLTewUJbCzH/N0saIa nw50zNAdqV0V6EoKqHzQc0F2ZFz/vWwS5Mj4rTeKmUp3KnJM5LEQIQm2M/d0VFt94jdl CbHTVpFKqL4WPEAP2GdeLFxjfAS15S/xfbRP6Jv1ZqUjWkJvo7D98LvFTa8rBCrz7PGU xF8rUgHV86lUDlf1yDcEj/JrVjhFV3eNEc3dbzjN4Fvh65TsRWmYuzSqMUVI4bcqBL5o LWCQ== 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=6E+ctilpvTRp1sWziPGrKb0bFclcGitH24520WnSwgs=; fh=xoUKUYwsHP88jVXv8iAtrUCIr9Fd+NLU74akQLg97ME=; b=IaK8eVQD908zX6VGjRnYSWf3rUZbZVGJnonMD4YqDjPcRiwj1GP7Z3lMUQK0vrMbhL PHRBAsajolIJ6bzq8CzZ/4vp6aBdA2HJWtsJcbPYXJFBda96jPzbVJVD1crumc5PH2JN M5Tg3MmXjFSEQZVDzUqSdQD7wfqrbozozLopXKqW3uE6oSc7P1iliraFZxEP3SCZ39iw 87fbuVpNd411JtrGPWr7XTq8N98dWyQhfMlCPIZZCzq9rHhntjGmEk9iMWfhcTJYXNwD iOARzbi2pxQg2OVKPLaYfmulpqFUTfJ/dPj0+/dA5emQ6GRrNNQgPtsI303AUoVAOdV3 Zg0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JSK08vOu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id k186-20020a6384c3000000b005ab05858e70si14153pgd.782.2023.10.12.14.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 14:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JSK08vOu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D6E45809C3A3; Thu, 12 Oct 2023 14:20:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442824AbjJLVUj (ORCPT + 99 others); Thu, 12 Oct 2023 17:20:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442853AbjJLVUh (ORCPT ); Thu, 12 Oct 2023 17:20:37 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F3E6A9 for ; Thu, 12 Oct 2023 14:20:35 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9adb9fa7200so291553366b.0 for ; Thu, 12 Oct 2023 14:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697145634; x=1697750434; darn=vger.kernel.org; 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=6E+ctilpvTRp1sWziPGrKb0bFclcGitH24520WnSwgs=; b=JSK08vOudVUto1Q85NbEBLbPAjFq7RUlB4moKaknBcZRMtp+TKx5Ir771l3TMCnwXO p4jfmVL5xfwwKTtWb3Rwn7VQ1FttL2OlYFIncHgSL/tpyzEF4/PJ6dEi319D185H9kgL okpUIicCZ9wG+uDaUSA1M7yzr0KSsxln9JaA5uTFw7L0Ig6VB6/THAGkxt8sWUGEJ94j PJ9ta3nO66/EQIdqnB9UBBlYT42kR0eXmwA6+rs4i9Z9eDn0o9vX2eIwzoM6dG5dgFcw ICxoNTQyznjbZPy+mxmFqZMDMxn5BkEyFVZJ+Qlk0ru3F+XbEwhvRzafMQwr3h2R2xNL SwGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697145634; x=1697750434; 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=6E+ctilpvTRp1sWziPGrKb0bFclcGitH24520WnSwgs=; b=BmFkKpq2pkHpn9e9LjR4YqZdN7WhmZgxrmk2t7SkKWejMz1Mr/f+ZLw7RdO6b1Y+u2 eC7DbXqq/4jojH9z8RJPk2ZsfIyircjngaFOqoWCDsY9ktOM/RyW1/7RKqrzPtlkTMtV BSObE68fmdWst3AD38/xhhe/9RQvgZoQx8SO2ElDDgi0Ow9+qintzDvluXdrx6dyIZfj A59vJwxskt0yyOrsRRE8y8/2OeUj2/qQy8piS/dQ7s6N8QSuVmngE6LNt6MVyh0UlsI7 xd+aEgmId+TVJCHePh77t1q7zQbTDqLG4OZxNGLIrPz6n4wDFnHMfHbO2baPzoK3RMtO 55mA== X-Gm-Message-State: AOJu0YyPCpWCdjjcGvdWbQrFqf89V/unCdRPC0Gvra1Zo6+dS4aQ/HqI koLyLhxQ0jaqx8tQwS/+wt8Aqiq3y064Lpn7yI5OXQ== X-Received: by 2002:a17:907:3e1a:b0:9ae:699d:8a31 with SMTP id hp26-20020a1709073e1a00b009ae699d8a31mr26012691ejc.33.1697145633579; Thu, 12 Oct 2023 14:20:33 -0700 (PDT) MIME-Version: 1.0 References: <20231010032117.1577496-1-yosryahmed@google.com> <20231010032117.1577496-4-yosryahmed@google.com> <20231011003646.dt5rlqmnq6ybrlnd@google.com> In-Reply-To: From: Yosry Ahmed Date: Thu, 12 Oct 2023 14:19:55 -0700 Message-ID: Subject: Re: [PATCH v2 3/5] mm: memcg: make stats flushing threshold per-memcg To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Ivan Babrou , Tejun Heo , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Waiman Long , kernel-team@cloudflare.com, Wei Xu , Greg Thelen , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 14:20:50 -0700 (PDT) On Thu, Oct 12, 2023 at 2:16=E2=80=AFPM Shakeel Butt = wrote: > > On Thu, Oct 12, 2023 at 2:06=E2=80=AFPM Yosry Ahmed wrote: > > > > [..] > > > > > > > > > > > > Using next-20231009 and a similar 44 core machine with hyperthr= eading > > > > > > disabled, I ran 22 instances of netperf in parallel and got the > > > > > > following numbers from averaging 20 runs: > > > > > > > > > > > > Base: 33076.5 mbps > > > > > > Patched: 31410.1 mbps > > > > > > > > > > > > That's about 5% diff. I guess the number of iterations helps re= duce > > > > > > the noise? I am not sure. > > > > > > > > > > > > Please also keep in mind that in this case all netperf instance= s are > > > > > > in the same cgroup and at a 4-level depth. I imagine in a pract= ical > > > > > > setup processes would be a little more spread out, which means = less > > > > > > common ancestors, so less contended atomic operations. > > > > > > > > > > > > > > > (Resending the reply as I messed up the last one, was not in plai= n text) > > > > > > > > > > I was curious, so I ran the same testing in a cgroup 2 levels dee= p > > > > > (i.e /sys/fs/cgroup/a/b), which is a much more common setup in my > > > > > experience. Here are the numbers: > > > > > > > > > > Base: 40198.0 mbps > > > > > Patched: 38629.7 mbps > > > > > > > > > > The regression is reduced to ~3.9%. > > > > > > > > > > What's more interesting is that going from a level 2 cgroup to a = level > > > > > 4 cgroup is already a big hit with or without this patch: > > > > > > > > > > Base: 40198.0 -> 33076.5 mbps (~17.7% regression) > > > > > Patched: 38629.7 -> 31410.1 (~18.7% regression) > > > > > > > > > > So going from level 2 to 4 is already a significant regression fo= r > > > > > other reasons (e.g. hierarchical charging). This patch only makes= it > > > > > marginally worse. This puts the numbers more into perspective imo= than > > > > > comparing values at level 4. What do you think? > > > > > > > > This is weird as we are running the experiments on the same machine= . I > > > > will rerun with 2 levels as well. Also can you rerun the page fault > > > > benchmark as well which was showing 9% regression in your original > > > > commit message? > > > > > > Thanks. I will re-run the page_fault tests, but keep in mind that the > > > page fault benchmarks in will-it-scale are highly variable. We run > > > them between kernel versions internally, and I think we ignore any > > > changes below 10% as the benchmark is naturally noisy. > > > > > > I have a couple of runs for page_fault3_scalability showing a 2-3% > > > improvement with this patch :) > > > > I ran the page_fault tests for 10 runs on a machine with 256 cpus in a > > level 2 cgroup, here are the results (the results in the original > > commit message are for 384 cpus in a level 4 cgroup): > > > > LABEL | MEAN | MEDIAN | STDDEV = | > > ------------------------------+-------------+-------------+------------= - > > page_fault1_per_process_ops | | | = | > > (A) base | 270249.164 | 265437.000 | 13451.836 = | > > (B) patched | 261368.709 | 255725.000 | 13394.767 = | > > | -3.29% | -3.66% | = | > > page_fault1_per_thread_ops | | | = | > > (A) base | 242111.345 | 239737.000 | 10026.031 = | > > (B) patched | 237057.109 | 235305.000 | 9769.687 = | > > | -2.09% | -1.85% | = | > > page_fault1_scalability | | | > > (A) base | 0.034387 | 0.035168 | 0.0018283 = | > > (B) patched | 0.033988 | 0.034573 | 0.0018056 = | > > | -1.16% | -1.69% | = | > > page_fault2_per_process_ops | | | > > (A) base | 203561.836 | 203301.000 | 2550.764 = | > > (B) patched | 197195.945 | 197746.000 | 2264.263 = | > > | -3.13% | -2.73% | = | > > page_fault2_per_thread_ops | | | > > (A) base | 171046.473 | 170776.000 | 1509.679 = | > > (B) patched | 166626.327 | 166406.000 | 768.753 = | > > | -2.58% | -2.56% | = | > > page_fault2_scalability | | | > > (A) base | 0.054026 | 0.053821 | 0.00062121 = | > > (B) patched | 0.053329 | 0.05306 | 0.00048394 = | > > | -1.29% | -1.41% | = | > > page_fault3_per_process_ops | | | > > (A) base | 1295807.782 | 1297550.000 | 5907.585 = | > > (B) patched | 1275579.873 | 1273359.000 | 8759.160 = | > > | -1.56% | -1.86% | = | > > page_fault3_per_thread_ops | | | > > (A) base | 391234.164 | 390860.000 | 1760.720 = | > > (B) patched | 377231.273 | 376369.000 | 1874.971 = | > > | -3.58% | -3.71% | = | > > page_fault3_scalability | | | > > (A) base | 0.60369 | 0.60072 | 0.0083029 = | > > (B) patched | 0.61733 | 0.61544 | 0.009855 = | > > | +2.26% | +2.45% | = | > > > > The numbers are much better. I can modify the commit log to include > > the testing in the replies instead of what's currently there if this > > helps (22 netperf instances on 44 cpus and will-it-scale page_fault on > > 256 cpus -- all in a level 2 cgroup). > > Yes this looks better. I think we should also ask intel perf and > phoronix folks to run their benchmarks as well (but no need to block > on them). Anything I need to do for this to happen? (I thought such testing is already done on linux-next) Also, any further comments on the patch (or the series in general)? If not, I can send a new commit message for this patch in-place.