Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp315286rdg; Thu, 12 Oct 2023 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbsbDIkPrZB5rleWviDCIC+TJQp5HzGl6QXgBqQZws/uXle2s2OV/gA4AI59gRnTMpJCo9 X-Received: by 2002:a05:6a21:6da0:b0:14d:446f:7212 with SMTP id wl32-20020a056a216da000b0014d446f7212mr31011361pzb.46.1697117789540; Thu, 12 Oct 2023 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697117789; cv=none; d=google.com; s=arc-20160816; b=Pgwtj9KZtDz6Sn22nC3Lkn+yhR7PMPm1Q8SPAwrOJnS85bgAA0Vr65VlB/cvIBw/qg VYQ/4sz0+scZhF/E1YsDFWZfd+BAkbolNkQzoe+aDqpkvXrYyCZwK7PqWrXLW1iPlm7q 92oviDY2mztFcQNmXEP46brD8zFDb5L1VpbNsSbAk3SzCI7dY4qmUjuN7p/NqxgJ6pnb MBVPyhluxIL9IrpRzbzh25OU/bSmVc9LSX3Gx6o7Ig2XaXRCFFDo6ZwownyiP2o1BGIf uxwQdfy7ZFN2nBabtRzd1ZF7o5yMp3rJCvxKYOlTt/lpPBmK2Qvkku4o7xB1943Dpm3g 1Lwg== 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=s/IHfa2K6n1mcSpH55sMGbJybaWLv+iEOtk/2jmt1/I=; fh=FliBBm5o+YgmQVfOIrBzy/uWPpKZJLxbs5bNc203T7I=; b=CMXJd2HYrZrKygRyXCzPP1vnW9mDw3kC5i+LA7F8kkdMym44U4Wu1fQaASxFhc2uup d1mAVU4puYg3YQfnbn/IRnLEgWpwOmVgeymuX8h5QOHV2DOsJZAQCgibxx/iDMor7FEC yKfCXOzO/5qA07Esci5bdSANJyinKVJ37cC3Ly/Fth7r05LUogQTU/ZdaFOcDW04ZgjC U9vhWORo6pTPAbIBgtkQPlUWpkf+JbwCTz6dDnIY6VI/7JW28R+JVyiN1XucqggJZEJ6 CiGwMPZ0j50s4JeOdjcmMDSijeuwZ5+dLMMoxi48ponG+5IBBnFPrjfvUTsEA6zmp0ag r1Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TcapRLni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id g23-20020a170902869700b001c7249f5e40si2033398plo.469.2023.10.12.06.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TcapRLni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 1E3F081B17DA; Thu, 12 Oct 2023 06:36:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378928AbjJLNf7 (ORCPT + 99 others); Thu, 12 Oct 2023 09:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378876AbjJLNfz (ORCPT ); Thu, 12 Oct 2023 09:35:55 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D123CBA for ; Thu, 12 Oct 2023 06:35:53 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9d4f08d7cso176585ad.0 for ; Thu, 12 Oct 2023 06:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697117753; x=1697722553; 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=s/IHfa2K6n1mcSpH55sMGbJybaWLv+iEOtk/2jmt1/I=; b=TcapRLni3kBnPSMWOjsFa7AGkQazBF7Y9KJPRMMjSAOO2HLbwgWghUxmYq7jjL4eNq yklG2penf3S0lpko2ILIpCl1zQsijTOOFfnn49wd8Ms7VFmDNzaTaqyWF03euMPnF/ri ILVmiADK0V6lnoJMSBkfMUmSJSI+1wQdCbTts+02JJesW7e3844cb6wJu61mpDjCbQUo JoWsPbdUQzuvfsbFr/edrwzkyYf500pJoZ2LRPHPZy3mnvRTaCoSZ9K2cxfonnvQ5+Z+ +66Qu2h/QGYNRqPUl/oud9R0zkrvlY/+ShzHL4e7u3a59NyvB3wo74SjzPla22TulwHI a/Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697117753; x=1697722553; 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=s/IHfa2K6n1mcSpH55sMGbJybaWLv+iEOtk/2jmt1/I=; b=H0jzObgdFDtS3zBYcXlBEnR5s5uufukrcmCLwDdvDvgwB8aN2r2eYfcXnN0IrYlUzN 4fLx7Me5XdBwJ1+YMTg1jrqto+JhbP6q4XnMbIgluUELVFZ6BIxCYnLxfbxGSw1L5Uks 9NS90vJQYdRnMVHZo6AmgFSCmFbBl3MnDwemyCSx+f0bOUYnnSF4n/FsVIAfEC5k937W 3fpE9vuXvHELQc8yRXEtfSIiqZqgw8tV7xqm12IEYNBlskwgezegS4yw5CPVLjfbUrof ZOUlgyxpDjuEfnFhMW9NUNyitG8AaY6g6v4ICeF4gj6jhsTZnfPXTwVHy3GxShINxN71 iNMA== X-Gm-Message-State: AOJu0Yzcvm52/X8zbn47btI6H+FaBLZDrzcIUbzxEDz8MEDtzXeaYPK+ bvZ3yHkIxrFxEZWG9pr0und0EHRlTYvGD3rNk8+Cpw== X-Received: by 2002:a17:903:2444:b0:1c3:3649:1f6a with SMTP id l4-20020a170903244400b001c336491f6amr444875pls.7.1697117752910; Thu, 12 Oct 2023 06:35:52 -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: Shakeel Butt Date: Thu, 12 Oct 2023 06:35:41 -0700 Message-ID: Subject: Re: [PATCH v2 3/5] mm: memcg: make stats flushing threshold per-memcg To: Yosry Ahmed 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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 12 Oct 2023 06:36:26 -0700 (PDT) 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 bo= th > > > > > > 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_control > > > > > > # 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_SENDF= ILE -- > > > > > > -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 parall= el, my bad. > > > > > > > > So I ran 36 instances on a machine with 72 cpus. I did this 10 time= s > > > > and got an average from all instances for all runs to reduce noise: > > > > > > > > #!/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 different. > > > > 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?