Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp378896rdg; Thu, 12 Oct 2023 08:12:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9Q81lVTf1FwFG/V7tbHmk5lvAUPt/k6xx65d45E2pCHVvXoWQlyKYr3LsTjWcAkdGAP0V X-Received: by 2002:a17:90a:3e84:b0:26d:49c8:76d8 with SMTP id k4-20020a17090a3e8400b0026d49c876d8mr22220616pjc.18.1697123556581; Thu, 12 Oct 2023 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697123556; cv=none; d=google.com; s=arc-20160816; b=yFq3mGDd27++yyQ/Jq1CvxoWf+/r55w8MyZ9Kwy4Jf4SpnipQe41nbgsobBDroGGws 2xeW2LEOckRJKVn606oCCk4mUE0e6AORtysqV8eVME+zMdLPNyRX823f63gdeycUG6xP aoASyLSgl1LM9D+7XJWs7UVOD5OgcWFBiMkheJML1zdrScQqOdg2mROffzxw6YgbS+rX bZ/sqECpjhMZZmAY1DBdKGxb2mEyZ1ScE4AqQpngELb7AGgxg7l5nJE8OFJ80mknJrMl Ur/E9jsVbtFFKcEQhqcAX9r/iH1OI4jvYPwgiWlOCioI8lZQU7hQZ5sbG8p6UjOf/lfa 0a9w== 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=bpDYHFY2dl9s+q1D4aeetz4SQmaXlkXA2zbUfRxzbYc=; fh=xoUKUYwsHP88jVXv8iAtrUCIr9Fd+NLU74akQLg97ME=; b=p8fAziGhoFkIkLLpD4Vdv4jRbGSM0nxvCy0OP0GMaC9nZvcveSYdOVaXqv/o7WBfbJ /nhZb+JMu1FNl42yPPUhtRGsFNqNjeyV6jPOzO6XNULxiAJJzTxNRHjR4Ff/2KVD1wz4 EFDnnbHQzSeI14aoVeSDhJhGfEbpLeyJX2zApR/zfd8zwXnSiqMnFfWTHdWpiP9feepp duw7wz6wAQF+TBSGkWblJ5wW8kh8aJnm0PLH8k+Zy5FwXZfI9z2YWYXtjVVsYtTq1U1l CaKepK7Q6qay75JeVAlPsUcz4fXakQDf9yrR1DHHxgqJbWSyoACO+k9ysy9IDD2PZrQY 5epg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=1vgSpiTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id mn8-20020a17090b188800b0027d1ce4ce41si764647pjb.0.2023.10.12.08.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=1vgSpiTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 603D580C877A; Thu, 12 Oct 2023 08:11:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347288AbjJLPKz (ORCPT + 99 others); Thu, 12 Oct 2023 11:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235668AbjJLPKx (ORCPT ); Thu, 12 Oct 2023 11:10:53 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9408CC for ; Thu, 12 Oct 2023 08:10:47 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-99357737980so181348066b.2 for ; Thu, 12 Oct 2023 08:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697123446; x=1697728246; 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=bpDYHFY2dl9s+q1D4aeetz4SQmaXlkXA2zbUfRxzbYc=; b=1vgSpiTF8MDaMpI22ZweEJ9hVWGL11+TLQ7qqObOYNCcCLtPVPb25FFMmEsDSukhm0 hoFq14DpP02Ya3y5NqjkN0NAd/MhO/j6tFwgSFL/9EAd4+iL04Vt3K7Jn+5ZKzXgY5Wj 747+Egnuif6W2SepQsK6S6S7AXnk4bcLwOQzhO09+9o4Sd7oWth610VRxf47Ws05j3F7 OfdZFGmCZxzRV4xsM/4HKOrgJwpxUT6Te0jcdcoy2E+1vu+QQwEeoiPva/eiAnTk+2Bp UdINlBPm5nUcgTU+KhetS3pS1sWs7ZWopbA2R5XCGXuWJd7UsQHXYzxpVLHZcpyxlR6v yvrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697123446; x=1697728246; 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=bpDYHFY2dl9s+q1D4aeetz4SQmaXlkXA2zbUfRxzbYc=; b=FPaYsb/UfCTb0RY/jmCxgoWD1x5nhQ65AtTeQzSYxVB2iI3gxXtUgMvzdBzqSVDqH1 GpVqSgxxBUeHFwxRJ0qESeu4xPLgFut374p/kBS7Zf8SlIJgqdN6V4NDI90cTaQKZJqJ CyLMeBAQtxBuQnm2StzpZZted47K3U1wJdwvq3QITnE3E2sX9bHLu8MQG7XUyF5/OrXG JwiI9v16DaLAnvUWfgVqZA2A2BfGen9F+HCvYXh5At08R1J0JAH7FKVb5lvmU1DmEUDL WJYcblNmFeGxEV807E0dNFLWSJ+zZzfHIILwQ5wYhWBMX4V6HXHsgj3EUL/GdI6cx/qu LjXA== X-Gm-Message-State: AOJu0YzunHV29Rr5Ht6ONZrTRS+f2l/uilR62aNU5I0rH5L/xFB/OftJ pm/90YhnjDfQjJwwTTq24/nAVIuamFFmqAad1Gi53Q== X-Received: by 2002:a17:907:b0d:b0:9ae:37c2:11b2 with SMTP id h13-20020a1709070b0d00b009ae37c211b2mr19347554ejl.15.1697123445857; Thu, 12 Oct 2023 08:10:45 -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 08:10:06 -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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 08:11:12 -0700 (PDT) On Thu, Oct 12, 2023 at 6:35=E2=80=AFAM Shakeel Butt = wrote: > > On Thu, Oct 12, 2023 at 1:04=E2=80=AFAM Yosry Ahmed wrote: > > > > On Wed, Oct 11, 2023 at 8:13=E2=80=AFPM Yosry Ahmed wrote: > > > > > > On Wed, Oct 11, 2023 at 5:46=E2=80=AFAM Shakeel Butt wrote: > > > > > > > > On Tue, Oct 10, 2023 at 6:48=E2=80=AFPM Yosry Ahmed wrote: > > > > > > > > > > On Tue, Oct 10, 2023 at 5:36=E2=80=AFPM Shakeel Butt wrote: > > > > > > > > > > > > On Tue, Oct 10, 2023 at 03:21:47PM -0700, Yosry Ahmed wrote: > > > > > > [...] > > > > > > > > > > > > > > I tried this on a machine with 72 cpus (also ixion), running = both > > > > > > > netserver and netperf in /sys/fs/cgroup/a/b/c/d as follows: > > > > > > > # echo "+memory" > /sys/fs/cgroup/cgroup.subtree_control > > > > > > > # mkdir /sys/fs/cgroup/a > > > > > > > # echo "+memory" > /sys/fs/cgroup/a/cgroup.subtree_control > > > > > > > # mkdir /sys/fs/cgroup/a/b > > > > > > > # echo "+memory" > /sys/fs/cgroup/a/b/cgroup.subtree_control > > > > > > > # mkdir /sys/fs/cgroup/a/b/c > > > > > > > # echo "+memory" > /sys/fs/cgroup/a/b/c/cgroup.subtree_contro= l > > > > > > > # mkdir /sys/fs/cgroup/a/b/c/d > > > > > > > # echo 0 > /sys/fs/cgroup/a/b/c/d/cgroup.procs > > > > > > > # ./netserver -6 > > > > > > > > > > > > > > # echo 0 > /sys/fs/cgroup/a/b/c/d/cgroup.procs > > > > > > > # for i in $(seq 10); do ./netperf -6 -H ::1 -l 60 -t TCP_SEN= DFILE -- > > > > > > > -m 10K; done > > > > > > > > > > > > You are missing '&' at the end. Use something like below: > > > > > > > > > > > > #!/bin/bash > > > > > > for i in {1..22} > > > > > > do > > > > > > /data/tmp/netperf -6 -H ::1 -l 60 -t TCP_SENDFILE -- -m 10K = & > > > > > > done > > > > > > wait > > > > > > > > > > > > > > > > Oh sorry I missed the fact that you are running instances in para= llel, my bad. > > > > > > > > > > So I ran 36 instances on a machine with 72 cpus. I did this 10 ti= mes > > > > > and got an average from all instances for all runs to reduce nois= e: > > > > > > > > > > #!/bin/bash > > > > > > > > > > ITER=3D10 > > > > > NR_INSTANCES=3D36 > > > > > > > > > > for i in $(seq $ITER); do > > > > > echo "iteration $i" > > > > > for j in $(seq $NR_INSTANCES); do > > > > > echo "iteration $i" >> "out$j" > > > > > ./netperf -6 -H ::1 -l 60 -t TCP_SENDFILE -- -m 10K >> "out$j= " & > > > > > done > > > > > wait > > > > > done > > > > > > > > > > cat out* | grep 540000 | awk '{sum +=3D $5} END {print sum/NR}' > > > > > > > > > > Base: 22169 mbps > > > > > Patched: 21331.9 mbps > > > > > > > > > > The difference is ~3.7% in my runs. I am not sure what's differen= t. > > > > > Perhaps it's the number of runs? > > > > > > > > My base kernel is next-20231009 and I am running experiments with > > > > hyperthreading disabled. > > > > > > Using next-20231009 and a similar 44 core machine with hyperthreading > > > 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 reduce > > > the noise? I am not sure. > > > > > > Please also keep in mind that in this case all netperf instances are > > > in the same cgroup and at a 4-level depth. I imagine in a practical > > > 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 plain text= ) > > > > I was curious, so I ran the same testing in a cgroup 2 levels deep > > (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 for > > 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 :)