Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp690873rdg; Thu, 12 Oct 2023 19:33:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6fudFyfQFxxjsFxXA93hvKnWCy/MMQ/CrxJvx2wlawgEsSAB0zwMw0XBlxbicHfkcfldL X-Received: by 2002:a17:902:f689:b0:1c7:65e3:e605 with SMTP id l9-20020a170902f68900b001c765e3e605mr26657245plg.36.1697164432174; Thu, 12 Oct 2023 19:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697164432; cv=none; d=google.com; s=arc-20160816; b=INHdbfDf7PyF81e3AkkcNDJqjBt187wfei7BtIpaH/9wyNqWxSCWnhL9EBSfb/z50J R2o4h9cTl/HYIGPArYZJW6Vr/BskDhkI2r6PDUEZ2EjxVIT6UFR6T4no53GW87WGxi4D DX+IHHDRukDS4SprTb50tblelBWo5a5wQ36EGb2wCCk713Eymqv2+KijsrbyWJPcZK/2 xPUTDcxMNteO69+XF17bDbKSFY3h/JJU95htzSAzXIOJXGol8/Rg3XdHQSfgBMbjdvmn 90YK8UT4wTM2EseAa+HzJrHxuc7cRQVEhOgZ8js75PPm0n23HownFrJgKYux58IGho4O RPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HQBjX16wvpXqrz4aN4i3iIOyZKlCqR0jktD0mRwUDK8=; fh=TwrmWDGKIzC/AbC9LX9EF6paIM8Xf9MOsZ70p54le1g=; b=rZpZj295GOdVBb4zYr50vOZZzQIHrmcQklBVDRntgi49QVqEYHTSLqUzaMJnG2KJo+ MfUhVuSrylp5RfHmyaZymsQheGfC4fhyBh0qownoZvUz/MZKh9KrnFkGPjmFokq8jqKu IrWG3sO9cqDZm2aAesRUjVNZYug8bqktFb30n9qA36OvSyZQ6o8gcoP2XAUW37UQLKdJ S0Y0URR/l/Jvf3CUV/xA46/ju3PBxNCE95ID33o1trwfrHKY6pj+AM1A7PZLTW1Izdqt nW7vOihKR054BhdOUfdJXsiA/b4S2h+ij5IPvj9kYV2YxZARQf+5Amu78H6V8Jgbadyi eLGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=v+v6xCwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j1-20020a170902690100b001c73e886f68si3405612plk.316.2023.10.12.19.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 19:33:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=v+v6xCwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2A451829F64A; Thu, 12 Oct 2023 19:33:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbjJMCde (ORCPT + 99 others); Thu, 12 Oct 2023 22:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjJMCdd (ORCPT ); Thu, 12 Oct 2023 22:33:33 -0400 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14BAAD9 for ; Thu, 12 Oct 2023 19:33:31 -0700 (PDT) Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-66cfd874520so9971646d6.2 for ; Thu, 12 Oct 2023 19:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1697164410; x=1697769210; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HQBjX16wvpXqrz4aN4i3iIOyZKlCqR0jktD0mRwUDK8=; b=v+v6xCwCyJXsXnt60GuPHdcfffRgm9LBKFXYPKOw55RzZnySUIzBr1/6fAtDyi+O2L CwZu9zfrX/NkMaX1H8BsF7nct8aZMeCqRI3G883dnE5T+QeAIX4kO2SkGLIt+N8qLGov sOxwNwu8BAX2zJAzk9OfAY8cAjEAtoSQwCux3HPqd17TRB3SQJx7R/4pVb+Fuo4Xe1F1 7UAHbhN2LaNYqmKrM60UDxuIoqrmNNPkJOGyYu0ZjSgb0N7hR8e0V0GSWvmp/scH1Gf+ IOQ30cTT6RDPNGx5JtqYRrExN/UKfci9BGH3wkUIsm00iql6UpDNSk4sPLQ7NtZLE+WJ Efhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697164410; x=1697769210; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HQBjX16wvpXqrz4aN4i3iIOyZKlCqR0jktD0mRwUDK8=; b=s6H/rQlZCDtCTMWkXa/jFEV8G+XdcY0pyPeDr1gwffKI/bZkpVoo3KN0MG3mme11XY kavz3iK17oYbltHCKaG99mgYbeg0pfj18yO7OV/p86+0fL+GpfLUvqkDn4UwKUtoH3pQ MZs/AsrDGSAmS9+prfv+IMun10yiA5/htasogIOv+K30JOxSZAuaM4SBapSyVve1hMNj iAj061skERW9yXSFGpxahcNvTJyAYg6tUsDvgKqp7lMr/V89Ie9TtrO73mHag9phtOib 1DByuivRBARdHn+9FHPEzBbpK+RkKSCDUmiDjRuRSpJKi4Ff4OLzNamwtAkomsocPL3b mdxQ== X-Gm-Message-State: AOJu0YznAoXRfjtPrd9NfJf2X9+iHagUWx80o0A5bERy+3VrEbDmhC7S 9IGxBikZvdoC5guZf5kV0jiirw== X-Received: by 2002:a0c:f194:0:b0:66c:ff4f:a35f with SMTP id m20-20020a0cf194000000b0066cff4fa35fmr9751346qvl.51.1697164410198; Thu, 12 Oct 2023 19:33:30 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:66a6]) by smtp.gmail.com with ESMTPSA id e9-20020a056214162900b00656329bb3b1sm304909qvw.10.2023.10.12.19.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 19:33:29 -0700 (PDT) Date: Thu, 12 Oct 2023 22:33:29 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Shakeel Butt , Andrew Morton , Michal Hocko , Roman Gushchin , Muchun Song , Ivan Babrou , Tejun Heo , Michal =?iso-8859-1?Q?Koutn=FD?= , Waiman Long , kernel-team@cloudflare.com, Wei Xu , Greg Thelen , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/5] mm: memcg: make stats flushing threshold per-memcg Message-ID: <20231013023329.GG470544@cmpxchg.org> References: <20231011003646.dt5rlqmnq6ybrlnd@google.com> <20231012132946.GA470544@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 19:33:49 -0700 (PDT) On Thu, Oct 12, 2023 at 04:28:49PM -0700, Yosry Ahmed wrote: > [..] > > > > > > > > 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? > > > > I think it's reasonable. > > > > Especially comparing to how many cachelines we used to touch on the > > write side when all flushing happened there. This looks like a good > > trade-off to me. > > Thanks. > > Still wanting to figure out if this patch is what you suggested in our > previous discussion [1], to add a > Suggested-by if appropriate :) > > [1]https://lore.kernel.org/lkml/20230913153758.GB45543@cmpxchg.org/ Haha, sort of. I suggested the cgroup-level flush-batching, but my proposal was missing the clever upward propagation of the pending stat updates that you added. You can add the tag if you're feeling generous, but I wouldn't be mad if you don't!