Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp626174rdg; Thu, 12 Oct 2023 16:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlWig60Yko43AH6c+OnOp3MO2uWv3ZErsMOPfyQdkPhpEvSWoxoaQ49DyEoYnsUWl73NCp X-Received: by 2002:a17:903:228a:b0:1c3:2423:8e24 with SMTP id b10-20020a170903228a00b001c324238e24mr28449840plh.8.1697153397723; Thu, 12 Oct 2023 16:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697153397; cv=none; d=google.com; s=arc-20160816; b=X9lzbh6ApfSrltaF22eLB70rFKbxiVgNOpjA/vIU9PKT3wh6tJ3E5tm0VFDXyEJjEi rr0eJbZ875iufNsK2N6WNmHUTg7sfJR3KSSts/k2b2I8g1bCRYEoQ/yk/QuAjZlf3+lL LQn269bmWrXnKdJihWHFABu4pJ4oWJ85exfC2500w3cP9/5IXCP+VHyxrDIujK7vtIIC zPnTtbektjgtlS4aeK7Rg53VEFApKrlVkjYai7pPHq53FjwLW1RmkFyzslyHzrqFEVvl iPoIaPI/NpOkNmSmmsTpbg8Ow5P34/y9pn9cR1O4RY9FtmtzpPAhH5sv6avWtKoNFhdC 51EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1TkuD/z8Ea8WYF7ftnX8CODZoRzj/hmgN33zzZIDYSA=; fh=Hw8XeNPePR0CS+ergDoXbaVZG3th5GHQorNWnQ5jlJ8=; b=MXSYNpmvYyg3vWyKhKcq2F5QwJw5OAbSv7OK/oqYkqJBa0syhc73dR2C3033l9y32q oUGd236b32VNoOSXNwlixjv/0shW75GQDL6wRckicjRYTYxZMRPmhEJoKMY6YlVeXiJw MFD/rX878pqzDFjEme9LVHzrdkCrSgApbY43mz7mjeMhhroqgC/XZzmx7QgmqKdT0ilI yvz+IwdD1xsDVImN5nFT/uYZ5W0KIbidH98FEH0m+Zf9Ti9u29pC2DvBPYEBnVmtsICb Kcwj5z+eQQItzgyR48bt8zBQt/ieQyWBars+OVLJgE2O81iUySRnPtHE1GrWKfbSfuap K3zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UFmt1M5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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. [23.128.96.31]) by mx.google.com with ESMTPS id z15-20020a170903018f00b001c470c5906bsi3310187plg.221.2023.10.12.16.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 16:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UFmt1M5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 80BAC809DE50; Thu, 12 Oct 2023 16:29:55 -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 S1443120AbjJLX3e (ORCPT + 99 others); Thu, 12 Oct 2023 19:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443129AbjJLX3b (ORCPT ); Thu, 12 Oct 2023 19:29:31 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C11B1EA for ; Thu, 12 Oct 2023 16:29:28 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9b27bc8b65eso245284166b.0 for ; Thu, 12 Oct 2023 16:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697153367; x=1697758167; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1TkuD/z8Ea8WYF7ftnX8CODZoRzj/hmgN33zzZIDYSA=; b=UFmt1M5v/IcLUQCK/67fxs2EUXoYS4NqBzMjn1qm45QtLvAESJD2vJl2ZQV4/FSzxz vxwqR+S3NBCbO6K8nbljZOWpJafC7WnYiG/G/DmCnNPIzM5ke/BKbprAncvWfjM+Hsq8 oaA/KAdPYeHbiw9e/pspQc/UrC5dhYwYxYgUU9OwevJqENrOjPOUGyKXYoSUMHPiPyND WO1rBOu3e0nq6Ilbco7ujpCcIrsfW8R1rzs/9L3H9seX8ope8ocIiEi3PtHtrtPcPuq+ 7ay3fRVQ60+hggYZhP2f/ONW4XMxzTjqge8ykXlU5VKefpP9wqa+oK09rX5aJYmKz5Lt cnVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697153367; x=1697758167; h=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=1TkuD/z8Ea8WYF7ftnX8CODZoRzj/hmgN33zzZIDYSA=; b=ZE2P3PoIjgYr23fKDjreWuSTCKrVl9XSYqpIijF3y+eLDv2OPxZgFU3FJ2nWNpRh6R oRBND/0BUmHKPUDewi5LHtyBDDaB/Edh0TkLsH0fdUV/reCtxPCtfatWTZPJFu8J+mo9 4tLGqUSQaFt5gyy4IzXaMfPP4H76MHgUE8oZHrvJzDIF6crcdiWWBRL6gZ75hSoEaYIw QeWujh3SCtLeO0jAT8TQX6E9ilLw+ADprnykISopQZVHF8s33hbc71CqmVJmlbGXEMvn 0gEYDKActLNL5DvS3QQIl+pZsoff8ird+DpMSBTMzkCNyvK3iOgO7Zysp8yG4jKWOK4B dNCA== X-Gm-Message-State: AOJu0Yxojtefxis/rfgUR9hIpNb+60jKL+8SuLBy6hv4wXOBIct33Kth ESnk8aYvPM3+A6mIx7pHEG5YqSBuxasvS2bgPdjssg== X-Received: by 2002:a17:906:31c5:b0:9ae:6a51:87c3 with SMTP id f5-20020a17090631c500b009ae6a5187c3mr23549400ejf.9.1697153366955; Thu, 12 Oct 2023 16:29:26 -0700 (PDT) MIME-Version: 1.0 References: <20231010032117.1577496-1-yosryahmed@google.com> <20231010032117.1577496-4-yosryahmed@google.com> <20231011003646.dt5rlqmnq6ybrlnd@google.com> <20231012132946.GA470544@cmpxchg.org> In-Reply-To: <20231012132946.GA470544@cmpxchg.org> From: Yosry Ahmed Date: Thu, 12 Oct 2023 16:28:49 -0700 Message-ID: Subject: Re: [PATCH v2 3/5] mm: memcg: make stats flushing threshold per-memcg To: Johannes Weiner Cc: Shakeel Butt , Andrew Morton , 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" 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 16:29:55 -0700 (PDT) [..] > > > > > > 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/