From patchwork Sat Oct 26 00:48:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13852000 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 03A11D149F9 for ; Sat, 26 Oct 2024 00:48:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 846536B00AC; Fri, 25 Oct 2024 20:48:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A7EF6B00B0; Fri, 25 Oct 2024 20:48:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 620366B00B2; Fri, 25 Oct 2024 20:48:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 470CF6B00AC for ; Fri, 25 Oct 2024 20:48:39 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CE894141387 for ; Sat, 26 Oct 2024 00:48:17 +0000 (UTC) X-FDA: 82713917034.08.690139F Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf02.hostedemail.com (Postfix) with ESMTP id 7CE1180006 for ; Sat, 26 Oct 2024 00:47:58 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SQvK4qwD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729903676; a=rsa-sha256; cv=none; b=rnnhf/NwPF/xC8Tc4QkqGN+/hP/e819kjRON1W+QLbcbzYyW4pbc67XJc7aP9/9XYu524u gi0Cf7HEm0d1nQDz7/QEez/T/7l5o/Og7vHvhjrkCFzhENIh6MfpNa64698oTeux7XWP+K SeBSpTEVFSAL6qX9lpCY2EDJI1IjJ1g= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SQvK4qwD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729903676; 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=7fA7WcO3E5pEDm+0LOtfHSLJ9cdNF7fPH0isXm9fWCU=; b=5sAElnV7a2cB9iDbtElNw6U2iUcepCKIC++W5anSvE5zTFad92eHAz5UCe71sGiWDat61O jIiThLfphnXu0mppWwP1CuxJx2EKH06vKbxkWK22WXXGuWjBiFyICpLUJY7LCdN9j6E1Aq UOYFzFtjijufjeDEfZEBccQkqi11vfA= Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2e2dc61bc41so1877271a91.1 for ; Fri, 25 Oct 2024 17:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729903716; x=1730508516; 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=7fA7WcO3E5pEDm+0LOtfHSLJ9cdNF7fPH0isXm9fWCU=; b=SQvK4qwDoLoPnvjp5AT+3mUOr+krHOYmFXp4uPTkV8QnkPBlmQDqezhHf4Hna/psw3 WbbEaSCqxBvrAi3BAsee2Wq4d+lA9bY844cHFznQN3dFs1TCO9XjMWL5ohXeHkrYJ6YX YdqXJ1Wb60K6L46DRZXI4JTnYtxN3g1vgFexggfUz2DHWDYYCdqE1E3TcSQHm08faQdi e57DP6ggjrOv/J4avNEcCTZg6mgbKAFzVwwSQ/sa16dEGQi+LFzbqYQ9YQcZJsbe+eiW CQEgbc8BZWMWzwTYeO+A0KpQ4I+qcrIyAfb7dvTifH63QJvrPUXVCIv0tCSRwbuH9k4V vLTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729903716; x=1730508516; 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=7fA7WcO3E5pEDm+0LOtfHSLJ9cdNF7fPH0isXm9fWCU=; b=UEDuc6jHe1jcxupbfLtxMKvtAl4lUPLVFUuJDQGjAQOfZ6KFBWaldFBNjt2qM5AX8O LnqbcKYaRRRIoOliKXigE2e6X5SSgDc2KrMnhTiec0AqnfJTLJP2r23vfoDTMdJ6uo8I FW1mPu+TGSuS/W8pwYfK3tJ5sz+Ud0grtgeIm1pjWweMlXSe3LT8NlYD1cVp9Tu9H+Og eAqAMH7icmydHxWirwIToQdVcMbS8ruWeKCOZPXyHADrT5cnJarXsAEbJkW3qXXoDaM/ mZDZTxxC3jb7iycAw4ix7eX1TP8mWqnZgBTD/2tTpPxpAHDCLf939HsoEn0r83dEJ3Yu pgHA== X-Gm-Message-State: AOJu0YzCvsDLvCg1wEEtmeHTg06VSDKu8e2Kq2nCT8GIR5xL5q4oVly2 uy1k8KDCOhzkfxcK1GJLL6NoMsxghQbZjEbtyZP+vK/1WCtjRAbk X-Google-Smtp-Source: AGHT+IG8s6V1enHwWFRipM3OcTqSi0KNhyZtfDNk2LRJn8DilFz1SDop76Gqj2Wixr8/K7JkamzbeQ== X-Received: by 2002:a17:90b:5201:b0:2e7:6e84:a854 with SMTP id 98e67ed59e1d1-2e8f0f53e17mr1650825a91.1.1729903716025; Fri, 25 Oct 2024 17:48:36 -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 98e67ed59e1d1-2e77e48ad66sm4249738a91.4.2024.10.25.17.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 17:48:35 -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 1/2 v2] memcg: add memcg flush tracepoint event Date: Fri, 25 Oct 2024 17:48:25 -0700 Message-ID: <20241026004826.55351-2-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241026004826.55351-1-inwardvessel@gmail.com> References: <20241026004826.55351-1-inwardvessel@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: u31ez7q49587qca5bezee5w19qjd51sb X-Rspamd-Queue-Id: 7CE1180006 X-Rspamd-Server: rspam02 X-HE-Tag: 1729903678-144549 X-HE-Meta: U2FsdGVkX18CCxQi1j2vOOBYMn5z9rPaxzxxHodoEiu1v4Hvh3cBMPZI4vgfddZ1jA0JVg1VkWUK75/raA3FXEkOgZDLdDgX7p8Lb8PEXFDNLnK9YmxHS9wtxrj6ah9FKEnuTGA5C558KFZSed5LadFMGOK0+bWEQLiCv59h5Z1exayVqEKyGQ97V9POyMLBqY1FaoUvBARBXMGkaCvingtu7eb3VUUYpOoBt+cMPgl8SeBSfLVZCPa6dWPiDajug/m+tDZA4ee2TdnY+aUmLOflDxm/marpGTPCKY5wV0wBoaxu1hrHf9kU5bu5vVb4uVssd/3qaIaOB6CBhCRLmv38+q+JAyLi93vOJle6VC0bhDlD3mp/nzlieCHwDQpYReHg1kquMvNKllPvD3C97E8JZOsNoW9BWzy4blEMmdq9J2RVeAYxU4brV+V2PVnN02w98FJohvacPWnGboriuqy9kNg+H2vP7LO8V/v9sj5A4rmVPJbtjAutjDoRT5Bl9ekDYu+NMWI0B+Yi/XAOYJGrHzhEVA9MVqymtQjfVhJKjM7qTkTWHWZjbhw0jt8Not3dXk3s5dS7OXt37hyhOFbmYi32fixUK1X1YbQQBrMxgOPamxTVLL0d/xJzYuKCZuwGx9Uik0G9brNx/i10UqEvx/aRaok1TcadyN1EHwBWmZYccZ8ZrA8Cl8HgRMmDRk/u8KOGsVQXMciAh9oaz6rbx3rQCsmise6xs+hoF266YC4cHvnw57wmEhM4KSL49N7nkj6j0UgDRfdyryiNp5y1WK4A1vG4hTp7iEcQLFFJXPD+T1nxdkYKGkCLbYZJ92M9rdFZbgPLkQUFebvnvEJAepb1ezuZfhmuNQ5NPcBTYvYmNuXPlRDxyjLk36gUvMY1MZqMWAsH0cAwTE+hyPig9O4oQedHECBXSYYz94/9jKVv99B8zNEaOUvAKtQClaxcgjKueDOj4hv+JL0 wdmVhtyO 5yG9XdR84uYO6LO+rrcK+X6GOp50wpKp7qotIWOM+cCZdaMP5+4HfxaXu6fKCwilbeNXNfBO5AOhVxLM42L9k2GsgjrFVpW1cZv3/KEec5GBVCSgqd3QxLqD43Wk8LH8nifTmczdT/VpQfyl9HbYkUrjmfrh9TE9c0QGVE9yY3FaWJ9LG9847hL3ewPMfqeLvHxg6BaLeeIxLCwyr6KhjilzR2ul9UrFNN7WYcLQu2OhCcWOWAUV0BfVt8xd4h72e6QGBfs3O6i1GnHyFqPnr1XOL5l8vd+S6qij9/eyi3DsRQoDpg50ElKX7YI7d7OYU4AsjNELKkmKT4DC+BWiPPvFpYsBC/yHQdhTWnTVB1pVUsQyoB8oy3yUqGQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000718, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a tracepoint event that contains the memcg pointer and information on whether the flush was forced, skipped, and the number of stats updated. Signed-off-by: JP Kobryn --- include/trace/events/memcg.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/trace/events/memcg.h b/include/trace/events/memcg.h index 8667e57816d2..dfe2f51019b4 100644 --- a/include/trace/events/memcg.h +++ b/include/trace/events/memcg.h @@ -74,6 +74,31 @@ DEFINE_EVENT(memcg_rstat_events, count_memcg_events, TP_ARGS(memcg, item, val) ); +TRACE_EVENT(memcg_flush_stats, + + TP_PROTO(struct mem_cgroup *memcg, s64 stats_updates, + bool force, bool needs_flush), + + TP_ARGS(memcg, stats_updates, force, needs_flush), + + TP_STRUCT__entry( + __field(u64, id) + __field(s64, stats_updates) + __field(bool, force) + __field(bool, needs_flush) + ), + + TP_fast_assign( + __entry->id = cgroup_id(memcg->css.cgroup); + __entry->stats_updates = stats_updates; + __entry->force = force; + __entry->needs_flush = needs_flush; + ), + + TP_printk("memcg_id=%llu stats_updates=%lld force=%d needs_flush=%d", + __entry->id, __entry->stats_updates, + __entry->force, __entry->needs_flush) +); #endif /* _TRACE_MEMCG_H */ From patchwork Sat Oct 26 00:48:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13852001 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 07910D149F8 for ; Sat, 26 Oct 2024 00:48:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B51FB6B00B0; Fri, 25 Oct 2024 20:48:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE60A6B00B2; Fri, 25 Oct 2024 20:48:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 891456B00B3; Fri, 25 Oct 2024 20:48:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 657F96B00B0 for ; Fri, 25 Oct 2024 20:48:40 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 67229ACEB3 for ; Sat, 26 Oct 2024 00:48:00 +0000 (UTC) X-FDA: 82713917412.24.85542E7 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf23.hostedemail.com (Postfix) with ESMTP id 3DF0A14000A for ; Sat, 26 Oct 2024 00:48:25 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ux0JGirV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729903678; a=rsa-sha256; cv=none; b=4IJ3f92lJwB3yLBKsEIELlZoNA2Hsy1z9s8vZAF6WXst096g1+DGmjllN1CAvVu6fKySyT uo/pr6vbWPVQBZiRZAI4lCqP6y+73d7KRiFN8NiHAVLjlIyetKQ5Omn/USyg7MHXyhIXJo 2gLaBeZLX/oeNu7chdCb2LvaPu9smyM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ux0JGirV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729903678; 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=B7wkW5g8TgqYKms/EFJSg4ezSMWpKMTpB9wnMr55mBM=; b=xlQg37cGsC2rbv49NkAlAG5cLXUfkijG2Eis+6eJ6USdkshLPsPxd2XRUS3ourKwCxGcAl d2G+FJSwlpHR9tO41Fqeqs4ZM4tn0g12b0FpNwCUTz+BwLeIqy0DdkRFnMP+UR04s1iYdD qZ13UnV4ulLfW7ebZnzylptY6qAp0vw= Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2e56df894d4so1975363a91.3 for ; Fri, 25 Oct 2024 17:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729903717; x=1730508517; 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=B7wkW5g8TgqYKms/EFJSg4ezSMWpKMTpB9wnMr55mBM=; b=Ux0JGirVlt3oYAxA8tNLmofZt7vHu6yTOOcKQkWOK4Gat8dcnsMEdirFKPlAuSOw99 gtDRBMIWYlsM2w4sSFNGhIONYuYZyuapMapCEne2aX1PebUmBAxS4loqAG4JoCecSV3u hwLc9ryEjYH1rELbLoqpWBMCeHQly+1cYy9Cph7grh3JXp7aTRVN5SCnyddRQl98Y3OK BIHAU59mb22abHZHiHfyCHmtvUNVnzxMigrQRPTj4BlA0frq3kwAMP41/bx79n+29/LF ehdWkWF2wJQS1LKEqZNWtO3HXCbwWyrNMqH05aL0oBKdxVrv7EtXKpRTRNeoLpId3BdG 0xgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729903717; x=1730508517; 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=B7wkW5g8TgqYKms/EFJSg4ezSMWpKMTpB9wnMr55mBM=; b=sU0Yf9oM9RZmIbYkzef+rrrXD3F+NLXi4O8PjCetXOm3Ip+/XTJQBOEeCNhF05oW7O 7RN8ljCBNCjsdzMUDTU7QWdmX2z3JtzAGZyD9Vc9Au+G1jeR6HQJXpd+8SX5Q+6444L2 LuaEaWSdSmXIl2W9qWXWy3eZB7Ty5rc5XJ3HWIYk4Le38n+3sVD4QtImLc2+bzi6Wbcs w4geZHxRelxUs6IktUDgrflx1vmu8REGNNn1WWLwyHsLEbCSi0e23bM4uIKSknzEkmcH NRhsmgb+uSqUj0rmfCbXPs68z/rQvdAqUAC6bXzoet9eo9UPHo0NsuS0zxUTVEd0L48X 0WNA== X-Gm-Message-State: AOJu0Yzch5G4G6+kMmE6pXvkNUYuAYAfKs3u8cAY8xSFKJvrfJxY8xef gUM7JntQ1jhJmF48WYHol2tvRNfWEDY02CB16aP6HnBayD1Fxa+p X-Google-Smtp-Source: AGHT+IGRa7wyJzb72DXQWRWTr+119ZVVaA6HoCFe7k1c8dGjMI4ZUfJOYX++19OXxKJqpUeCJq4grg== X-Received: by 2002:a17:90a:ca07:b0:2e2:e597:6cdc with SMTP id 98e67ed59e1d1-2e8f107c680mr1496488a91.22.1729903717298; Fri, 25 Oct 2024 17:48:37 -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 98e67ed59e1d1-2e77e48ad66sm4249738a91.4.2024.10.25.17.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 17:48:36 -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 v2] memcg: use memcg flush tracepoint Date: Fri, 25 Oct 2024 17:48:26 -0700 Message-ID: <20241026004826.55351-3-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241026004826.55351-1-inwardvessel@gmail.com> References: <20241026004826.55351-1-inwardvessel@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 5paztqowkxs6cchawanobbwefsk7884b X-Rspamd-Queue-Id: 3DF0A14000A X-Rspamd-Server: rspam02 X-HE-Tag: 1729903705-16274 X-HE-Meta: U2FsdGVkX1+QdMOT/ZvepgFSXLwZxkIsVLYXy3HWyWD/MopaNGXzHqAa97Knl1aCRb35YLAKtA0gTwzwA9oGTgixaioUBB8NDRu1E2E1yHVmhr7qyl72ijK0KXgs3vZGrr4sy4i3gjdU9aNgpaU9v+rc9mgIDcrFqiCHKyeKJ/eDAUmhTigILYYKoE8rtT5qcg5AFg9ykIDhlI/HY3HZilSuWmJ6yXf0FRQtuyHmRsJH2z/8Pq+sEXxEaAvxkVUiK5rPyF8iwvaCrrVDNg4ZDLVBGL8tW7txQMfJwtbsInshY/tasJdNGIPmeH9/fMLSSN0Mta1sxSJOb1ku1evW+rsI6AO7Nt6t170hnZcA0qoyWBfuNh3WVIiFZRPHifZyATDQzC6h13E+aZ12KWvvd2NSp+/NaJ/i26KgL0+V/BgMT+kBoHt7PWu3y94cHbuxnP/qzVE95gVUOpQEaEaJgl46GBH7aZ4nI/isOvyRbB7hXYj1xyFJXqxKgRj17T76SV6e2uv1QQf7JVLUf4ZqgS9lJ1wIt7j0aoqy49PTHLyvwUsTJK5KBNnhP5nCoZ5/e2YSQ9NVfqJUsYigB4LoSEYIDMnOU9gxK7uo95uWPeRMk6IwrmvYH1itnZGioDqiZhLxYV49o8iGwQBtOLkyrd1iG8jskoL84tzYa2bVuqpdsFjjMvWLBpasmgN+RyjjRDfaZs5oUVznMw4BQJrpJr2Vp9dPNzemYk5VdLNCCUzOVl/3kUnRjanR5AUUYPoqRfWWG32JzVgtYanhtwqm1MEynvZ4fRMdx/pl/R47cLxdI0zcYrSbs2u9DNI4uwSxXkiEfb1vw1fOVTHiL26KIw+nrVD/gImlxpepJC1oZYAumhhM4VHWDFy5GCsG7hPxDfLK8QZ1cGXtvtB54KwWmKM/WWNk5nyenqBrreHuvuvEU/IrWTv4qpp+a/ydfKUfjjFjLMBZvrESb8oYBmg XpNDuJlb WzZ3BJMMsHXNaz6FmZxngcWIwnq2XziaCLG2zknXzb2YiIJx+ZKJF1LmmYZYS2FNsgW2FjreM+ZHbOfiIZXPlQli4bQhrWeC7HQf0VbdZy5mVm7JiBTrjVONj6RI62bdX1CdF9+PcF9nnF/xAv+3rvOQw6LRxuN0X1dvOWqi+Npa7jjMQpFO5ofhvv5QrfXYO74UCPm6AAOiijr33L4QPP2s0lrd18yj8cHIu4e5Ozn6oVytLZ0PC71ZqXo4PkLXdHd+H5QfNlEozbsGsk8InUlu1+1zr/Mb6cgREBXogZ2qoISEqmsw/11ZHuCbodUAWVEGe3/zGuZT6JM+8rS+dvrs4QhQF6WMOwiVjPK0oPFvGShnlDZYnHfmf3Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.003646, 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 memcg flush tracepoint within memcontrol. Signed-off-by: JP Kobryn --- mm/memcontrol.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 18c3f513d766..c3d6163aaa1c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -588,8 +588,16 @@ static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val) } } -static void do_flush_stats(struct mem_cgroup *memcg) +static void __mem_cgroup_flush_stats(struct mem_cgroup *memcg, bool force) { + bool needs_flush = memcg_vmstats_needs_flush(memcg->vmstats); + + trace_memcg_flush_stats(memcg, atomic64_read(&memcg->vmstats->stats_updates), + force, needs_flush); + + if (!force && !needs_flush) + return; + if (mem_cgroup_is_root(memcg)) WRITE_ONCE(flush_last_time, jiffies_64); @@ -613,8 +621,7 @@ void mem_cgroup_flush_stats(struct mem_cgroup *memcg) if (!memcg) memcg = root_mem_cgroup; - if (memcg_vmstats_needs_flush(memcg->vmstats)) - do_flush_stats(memcg); + __mem_cgroup_flush_stats(memcg, false); } void mem_cgroup_flush_stats_ratelimited(struct mem_cgroup *memcg) @@ -630,7 +637,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. */ - do_flush_stats(root_mem_cgroup); + __mem_cgroup_flush_stats(root_mem_cgroup, true); queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME); } @@ -5281,11 +5288,8 @@ bool obj_cgroup_may_zswap(struct obj_cgroup *objcg) break; } - /* - * mem_cgroup_flush_stats() ignores small changes. Use - * do_flush_stats() directly to get accurate stats for charging. - */ - do_flush_stats(memcg); + /* Force flush to get accurate stats for charging */ + __mem_cgroup_flush_stats(memcg, true); pages = memcg_page_state(memcg, MEMCG_ZSWAP_B) / PAGE_SIZE; if (pages < max) continue;