From patchwork Fri Oct 25 00:25:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13849862 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 80E2AD10399 for ; Fri, 25 Oct 2024 00:26:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50E4F6B0088; Thu, 24 Oct 2024 20:26:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D1A36B008A; Thu, 24 Oct 2024 20:26:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26F826B008C; Thu, 24 Oct 2024 20:26:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 04DC36B0088 for ; Thu, 24 Oct 2024 20:26:10 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4F71BC0253 for ; Fri, 25 Oct 2024 00:25:50 +0000 (UTC) X-FDA: 82710231954.22.22DF9DE Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf18.hostedemail.com (Postfix) with ESMTP id 8516F1C0005 for ; Fri, 25 Oct 2024 00:26:00 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UY0Fddyz; spf=pass (imf18.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729815891; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IeBx+IbfCPsZzGBrrw0brhnGHzVrpkG5SByugERHPp0=; b=A8sy15bBF5Yip40QVRfwXaKb6gBdUjsl/RENBLfR9nmUK95ttZo7HQ4tCBlUt/DQjAAzHp OiZTflmawwZiLaSmt5mTTXcjlstoc9ubcdUiFj9xtey6GJjSdp6Ty7hAO7VtRSNh/a0JzV ZwCQG8ubmD5auyY+skJDLAExksHi7K0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UY0Fddyz; spf=pass (imf18.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729815891; a=rsa-sha256; cv=none; b=HlV0Uz6toCScflUl3eWorxlVV1A29fKH8d6LFl98DXRzdUSM+sBWH/gIy5K693RpCS58JL WcxK6XvqhhBaTiTOtApqbCxG8QCsATQClfVaRn+nacWCtDBvnu17iP+IejRzy/OxgHHgiK 4EaLAhP6b7fBX6VNdR7plb5r1cckh4w= Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-71ec997ad06so1044760b3a.3 for ; Thu, 24 Oct 2024 17:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729815967; x=1730420767; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IeBx+IbfCPsZzGBrrw0brhnGHzVrpkG5SByugERHPp0=; b=UY0FddyzTnoQdMDtA3nzoQx0TgCBMP9nepzkXA+HAIUPx0i31ZraYhihsdZ65B9eW7 2Txl22r5fc0CPe33HQkbIMcUb+6WZpAbTO506+/RzelPAG7dMAY1gMbCufg9BoSYsOmI 4nyv5cnKvdvTVAhic1j7cpHuloHUKRRx9pyXlfOwp1Ht5Nd+t+BIEm4fnBFh43E4mFhR 5Z5rYjV8vHKHitZQRmNTu9Rdcvh25QdL7xXwRAYZGGAaLiOxo30umVINuhhgg+o3runq /LvwGOkOtRLr+SyfzUhTPa/YrxfpHnoheyuTjShUI8Rn0RBHVbxF0XQ0PtlrMkrq83nI TtNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729815967; x=1730420767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IeBx+IbfCPsZzGBrrw0brhnGHzVrpkG5SByugERHPp0=; b=jxgnj3dUB93GNwtlZ09TbXmNeeGYIiK+H7s2imOS6jLNqoR4FRbk8MXorSmieUmpk4 vXtdY/HPX/NCrpIq83M6Bs9OZOlpiTVMKxFWLD+sUhtpFduJCuAKu6Dm/Un1Hl1qZW6V oxJiOQbk2A0NkhAmmqvpoD5K3F9E2y2AZQLa/IGpx1wHC3yAQb3qYt+e8puuODYOccce HSrCCpNq9s/d6S6qc6LtSwQ15qH0b5k9WmrENLTbb13q2NolznMaQneW2K2MHrxEFKw6 XJFXRxsIMhHaPPPrnGBpqeKCQRHYXiGlpOOql7/EckaZ8n/cyd3+Qz+sKycsLS8B6J35 mEHg== X-Gm-Message-State: AOJu0YyixEscOwaclShDVIL6Mtk+PH4cOUB6G2vby6qw0cPeYf+qXBnr dAHlxmHyAHzQHJ/4O5TaqdygTZY4qPifc2Brqps4/8AVueq30gmA X-Google-Smtp-Source: AGHT+IFIiZZgA8TzhxiZ3F2VrQysWarw5zg/4+RqEpp72bYL8zTqxgSi7bgWMwkFE54ASqr6EpiuOw== X-Received: by 2002:a05:6a00:390a:b0:71e:75c0:2545 with SMTP id d2e1a72fcca58-72030ba31e4mr10445343b3a.25.1729815967198; Thu, 24 Oct 2024 17:26:07 -0700 (PDT) Received: from saturn.. (c-67-188-127-15.hsd1.ca.comcast.net. [67.188.127.15]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72057a0b707sm21572b3a.128.2024.10.24.17.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 17:26:06 -0700 (PDT) From: JP Kobryn To: shakeel.butt@linux.dev, hannes@cmpxchg.org, yosryahmed@google.com, akpm@linux-foundation.org, rostedt@goodmis.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org Subject: [PATCH 2/2] memcg: use memcg flush tracepoint Date: Thu, 24 Oct 2024 17:25:11 -0700 Message-ID: <20241025002511.129899-3-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241025002511.129899-1-inwardvessel@gmail.com> References: <20241025002511.129899-1-inwardvessel@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 8516F1C0005 X-Stat-Signature: pqc8wke3hayd349dia1rzef1tyzge78q X-HE-Tag: 1729815960-638628 X-HE-Meta: U2FsdGVkX19tIP6EwZ9NoWdY4DUEwgBFxnD7v6OVvL5afviebvh2f3dOZwhqOe7K0NpuqAY7wxZLrmlIpEBQtJ1/PMONpQLqEtRcQD+f4u7bqQCF2izX13AGkcHcBlqJbuBGDxLyYhmimdR+AnESEsdp5EdeHOnqpbxq9CqB33mShE0SFew30AVNhqWgDf8Ci4xvJfRs/6BKJA3rRslqDsIRLwsSQ/m0eh8tA3CbK2JeDAw0LpALirboBbscVyjJRs7VjIGVdlvDhSuS0Zz5zMdvghegFVusPzA35Egrez6022ldsCVkkEE3yAD0XnotUPQShxWKhKvp834uS6nLvsxdGuRQRwAP8Xe6CxG0piv1VNGUao04BsNVGD+8pmynu+l2ZC5nLjsF8irsCVKNozInFSnviyqRgn8OYsv7NeE0F9OqI9RRnyI4B6AyuREeQyYSnExbwIA7pFyOomTX2xB+teBweOMQ6StQxFhsyVdIN3lQkfGFbFWZo4eEEayQThXxtXQ+gLMWRjhqEH2U388gmD+w3QoV/KDvBQvs8tzKctHW2G5oeDS7YYEj0T6ynw9LahR0umPqVBI+HNiEnhK6hWSzIH/9QYEfkL1FmsjhUe8FYOM76nJpiAadw/Z8w/fMRJShqAhg1uh7Phxcwbbyiv+ihBUM4GT7NfjhYQY35gXJkUA+vkKa7iSUZ9UYieOMxirEYexVDAGRGAjPhC7hkAwSTKozFovUtnZWy+2amxwKK/99FiH3zr1NcxLa6IIMKfmVpt2Oo61E4NAXd2wwtr7lReZMiPzdODJeI0wlpjKrTc/NDhQ+5CkAE16XzRuri+QGdIMtYVyJxecqqzrQsOmR1lBcOMdMTRXLAik318gPFKc4YIMZCL42fi8Y0fetrxBU/pyLfpwcnyA1k40DNoOJj+NwlMeaeLUpOHzqw6ODMU8rZHg2kioeytGJqLxlMuRGc9/3nj/RxK/ AInuoIs8 9LX4TU6u5ZWbSyTE0hHI1+XtP3qnoijPkauD8RwfA3cO+UPiwkYIihpTmYOCMgfKlxlBcCk9hQufOqD8Pvp1auG5kAPsUYVJ66RuWjgkfJ4MDdCifF1buc86AYWMOcHaJFbMZ0+ZneVHSUubGa0YN2PaSX+jmMExjZ7DKWV1peHu7+a+skDMiLkA1OFn3dSH3JB13CfllM2DzujXBCcnFRpmNJ5e61FrfHOoMJuu6GloXKOVAJ3fkoiCVNvh0njoTaV0UOcXC8kctPAI6lg73JvL/JeW12+ve7cihdUSYbgAYtezJaNSkRH6VwdPbjrj0uEe8NCAU9/rWsTasVHXmHcn4Vh7ZgK7xIH9hThdpoygRDpCjxfkFdoxIaA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000635, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Make use of the flush tracepoint within memcontrol. Signed-off-by: JP Kobryn --- mm/memcontrol.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 18c3f513d766..f816737228fa 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -613,8 +613,11 @@ void mem_cgroup_flush_stats(struct mem_cgroup *memcg) if (!memcg) memcg = root_mem_cgroup; - if (memcg_vmstats_needs_flush(memcg->vmstats)) + if (memcg_vmstats_needs_flush(memcg->vmstats)) { + trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_READER); do_flush_stats(memcg); + } else + trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_READER_SKIP); } void mem_cgroup_flush_stats_ratelimited(struct mem_cgroup *memcg) @@ -630,6 +633,7 @@ static void flush_memcg_stats_dwork(struct work_struct *w) * Deliberately ignore memcg_vmstats_needs_flush() here so that flushing * in latency-sensitive paths is as cheap as possible. */ + trace_memcg_flush_stats(root_mem_cgroup, TRACE_MEMCG_FLUSH_PERIODIC); do_flush_stats(root_mem_cgroup); queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME); } @@ -5285,6 +5289,7 @@ bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) * mem_cgroup_flush_stats() ignores small changes. Use * do_flush_stats() directly to get accurate stats for charging. */ + trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_ZSWAP); do_flush_stats(memcg); pages = memcg_page_state(memcg, MEMCG_ZSWAP_B) / PAGE_SIZE; if (pages < max)