From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3F3FCDB47E for ; Fri, 13 Oct 2023 02:33:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D8DA8D0016; Thu, 12 Oct 2023 22:33:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 888C18D0015; Thu, 12 Oct 2023 22:33:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 750888D0016; Thu, 12 Oct 2023 22:33:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 64FE58D0015 for ; Thu, 12 Oct 2023 22:33:33 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 21DC91403D5 for ; Fri, 13 Oct 2023 02:33:33 +0000 (UTC) X-FDA: 81338867106.11.4A2CAE2 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by imf04.hostedemail.com (Postfix) with ESMTP id 317BD40010 for ; Fri, 13 Oct 2023 02:33:30 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=sWeAv9p5; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf04.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.51 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697164411; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HQBjX16wvpXqrz4aN4i3iIOyZKlCqR0jktD0mRwUDK8=; b=N8HuSaEoSylPT4KZ1f5zoWq31X1/tG8mhElR7lGo2fR8V3kbV7ToNSrej6YQrkqHemiGgd kr1h9wVXokKeyU2crWha0fX32gAWHF5qA5MLqNI+aiYP1q6Z53mwpD0N+pjLVruZ+wsEJD OSf8uAy9JsUWConQahthVP2dxP9nw+s= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=sWeAv9p5; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf04.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.51 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697164411; a=rsa-sha256; cv=none; b=5644hs08o3c1AhqXc2H/X/htzSanLRwEAP0W+EsC0qbk9pwtDcCGt2+iQ5/kbD200TCyS6 qoeLgLIz4FNRc1dIKsnMxDFLcI6pwVTF+jvmGPeBaD1nE/7rrOxIrQTjArG6ih2F2qdNhg KcoKdp/dsqyVptofIQ5seyk0oVvUl94= Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-66cfd874520so9971656d6.2 for ; Thu, 12 Oct 2023 19:33:30 -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=kvack.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=sWeAv9p5Ewgo/1IdrgcuiuZsItBiITuEUnINiB6AMAM4TDgk6LyMGVYLqA/5omK9dZ UzX3gtVVRLuyi/GcQ24fUiH501LRvFfFNL7gcY3NJsQelghML7eTRip0MSgX3nTEaRpc bgpWv4Am+fYEUIYx3XiqhPKl28hUnmbja/CK3D5xJHqjCjOugKzQYaB0ZJtlnPuXhM3i JYemryjis1sYdEewk0R+bj3nvPBDUBARD9PH+VT9HoOMrFR/M7CYBUye24lHAQNaa1xV e6w7eHoDWLBlMiIwQdNOVuZQolaCtHp2EkEvBdn/XA61ALEGHpHCblcEdfrxyLPCekEM q89A== 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=Sbii/fCz3oaXGnpGrgVz3KbPmSNgFmk59z1ysS50jpe00XIxsCxs/O90jziYDdmFi/ VvR5NaRtPBOsdu7BjL329N44U4fYAakR7o6QWHwdRRcqw1z+K3YqARUMoTWJQLX1u4HV 8WXl2w0Vc4a25M5WKB9LGTTPdWhrUzkkmyRIdxp5lreklllumn2cXKF+nqkpOLvstt53 443naSqt8VGWbYUhpWWyoiwG2NajI1Sm5oL+xwXPR9CV2nyi+yUFtaig/spLoZq0c7vb W2KNWZUNAU43UuWf1nvm1sNGmcnSMJ+xGt7ebF45RIXvFMpGJ2QhM7Z1trnppxYjqt+T jMtA== X-Gm-Message-State: AOJu0YzKzIfNdcBp1hMlcAZvhWnMzvk6ZqLhonlj/cw7GodkP3OB9Oct Iv1DuqBCVJTmHmCqY7iv+64RqA== X-Google-Smtp-Source: AGHT+IHce1yeyufcNiwtojg097ZByIxT0sqkyjp7IUQBwixMQxEAA1gP7NZxZR02opFmmqgWe9qyng== 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-Rspamd-Queue-Id: 317BD40010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: fogukarkdg5aeaim7qoanb85un1iugm5 X-HE-Tag: 1697164410-614316 X-HE-Meta: U2FsdGVkX19GDZsmEANuyEdiOaKG6K+ZpYEA4h1odx3t7Wmh230UW3Cei1KjYGb3NU5HCZqAa1uDwNGb8YtC3br6kJnCj5Qo+FsCswaOLS090uiKylcUWgIqRcYDZeUNcJQCybFLYOwCyUSCaAI+R9wupOtr4H30xlp7Aq9ys9Vnm3ObfmZ8Rtzp8M2WZX+gRMWCglYJRJyW/L3PAS4Phz6kTpGV3kGDgtabWp7T6ayeBv/DY3b4AdYBJodjTC0QG1dOA8dgq6z6yypduD0vPHpkk24c8jLN89Dp/5AAbHOl+xyIT1B7PW6NnNdKZt+wqOn0ZBBKa0w/Wx7wFdk7jN3DUZ8WN10LzWCLXWthnNOYXb9VTQf32enD63UZ932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oWArZfdgfotkdDannQ9CDxLU3ZAkMEYH7wjRP7bMCxQZ3c8PwXTiapiPkmTP2pqxeQZ3nEBUr4gIS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000031, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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!