Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2322458rdf; Mon, 6 Nov 2023 10:32:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4/ftXJkwbfTMOLgfNQL4EZueIuX8kmxHQYqlx71Yml2DuOmXmEw08YRyoPJ0d7QSgj66I X-Received: by 2002:a17:903:1053:b0:1cc:31a7:88cf with SMTP id f19-20020a170903105300b001cc31a788cfmr18333499plc.40.1699295542146; Mon, 06 Nov 2023 10:32:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699295542; cv=none; d=google.com; s=arc-20160816; b=mDZXKY1mZS5KgmycB45FrDtr9WP1yDJeO/iXa0gH0G8MjuThl7qlFzL83myQq7xmLp qVbkchoPy8EldfpHgFaMNJbhznkjakkdSLw1KlS0OXbJbIvKiz806mkwFbL09PD2m9VG AMHj18thtTtftnzYRcRuN+ValixO2CFASmriBpN8JALu6jZ/SErVagtHVzW6n0QGPNhg 1P2oeUdWeqyxkt4NS+u/ebPtDGWNdUZBYYZ81MvSZu38fAEpDqkhZ9n0zFc+rJ1yt3wZ frss8Q13aGjZSSg3lPGa3nVTB5e9/vylAJ+LZ8ws9xCOPwbwAYoUOVEoHG90uBSNbXkB IgcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CKTpKLeSBdUqUozne8dOLG7XHxiGHFR4EgqMwDuCKlY=; fh=5ynFD2G6LA0fdRuAOSZxbBxHoIIG4U3xrwbnkupZs28=; b=BIxesLaD5JcLNpLaHMqvJKeHMAciC3TLaVy4bsySwgfNG59vHIdpt2siw0rAJ2nrnf THc4oqvSvwv/W68qFqSMe/gMw1ohU7WDle5jpJuXlezTjS2iNsDWS6VU5DKbkvqWiS9Q rO7kymYhI8TqAK1EZYjmwLjeolsgv8MK9m7OUU6vM/ZYASVTmVum4u8bMXy3PkpDqlPN Y4b7gEyRhkbcwX3st9D4ZkWEaO1RSb2K7xF1F3uIxj3oM+rMoL2cE0NjEnrzBcwvwhl8 xmkFfukxky1zn5D1JHCY8LowdxRSpNu3dkOMsreozwt9stgcxnZ1zZu+QA8jw46PUH89 OVQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="DQEAu/8T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j3-20020a170903028300b001c5cf1c30cfsi9208645plr.435.2023.11.06.10.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:32:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="DQEAu/8T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 339DD801F770; Mon, 6 Nov 2023 10:32:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232685AbjKFScR (ORCPT + 99 others); Mon, 6 Nov 2023 13:32:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbjKFScH (ORCPT ); Mon, 6 Nov 2023 13:32:07 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44AABD49; Mon, 6 Nov 2023 10:32:05 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6c3077984e8so4053981b3a.0; Mon, 06 Nov 2023 10:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699295525; x=1699900325; darn=vger.kernel.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=CKTpKLeSBdUqUozne8dOLG7XHxiGHFR4EgqMwDuCKlY=; b=DQEAu/8T6Zlvmk8QXgJb+oVwN1lFWiAgQOtG7oTLgE1ZxOtDfHeodJk9Cn4bjZGGk6 y7ThCkWVBjkbDUHInA/cNizKDmk3bFaEtOqsu59AlgQoMeIlimbwtr5unijvmHuct2Vm a7FNUxcWLeYX+QZAfVpWCNxBV6YZwCw601B7Ju4iT854fJuRKaaysVOxBDBPhktKZw2D K9JbGPzPZteaccjDLGvkx2556K20tfRVetEiRRFUj2QQrORyk8tWEVapQY+bsmfiUtEm BsaS254XNN6zZDg9kuEHBiCXeBCGAVW+wBV3KEBHwWCVukc9tTf0svfADm9znEPzl6sH bRaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699295525; x=1699900325; 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=CKTpKLeSBdUqUozne8dOLG7XHxiGHFR4EgqMwDuCKlY=; b=UbHiq0lBH/wSkMsiVzQWE5BQRgckF/oVh12lpFWAV5nAErJKQSaHCxZxhm9YRXDqRq PztjEzjmIDeUF18gHK0HQZeJ7VpgKpYcBNw7Gd7zVkJVMPCyTG7CLfNUc5mx1tiJGujk m+s3SuoSy2EFtaB4LLFnRl/mYQuuHCD9XskjPyeUYhMrcVSKz/TjyJS/VKfKND+cV0am kQGpf8nJmyH0yd3r+rD6KLQ725bzJUeqGh8jPG26gCDvrg3nT/bHeMru7cmUWL8UwG8J tAejssRgyhoAr2wFgFIB7EXoAvX5ogDzT4jivpUHuB0la+1BbDzLNxqC51ONZTYEd6nT qEeQ== X-Gm-Message-State: AOJu0YyRkQEH1r4GLPa5uMMDNhLoK/jBBg7cZyYYd5yfpqb951iSdK8A wC2aZFOABemMiOT9MNWzut4= X-Received: by 2002:a05:6a20:914e:b0:172:83b8:67f8 with SMTP id x14-20020a056a20914e00b0017283b867f8mr26904604pzc.29.1699295524682; Mon, 06 Nov 2023 10:32:04 -0800 (PST) Received: from localhost (fwdproxy-prn-119.fbsv.net. [2a03:2880:ff:77::face:b00c]) by smtp.gmail.com with ESMTPSA id j8-20020a170903024800b001c9d968563csm6161658plh.79.2023.11.06.10.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:32:04 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, cerasuolodomenico@gmail.com, yosryahmed@google.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, chrisl@kernel.org, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org Subject: [PATCH v5 4/6] mm: memcg: add per-memcg zswap writeback stat Date: Mon, 6 Nov 2023 10:31:57 -0800 Message-Id: <20231106183159.3562879-5-nphamcs@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106183159.3562879-1-nphamcs@gmail.com> References: <20231106183159.3562879-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 10:32:21 -0800 (PST) From: Domenico Cerasuolo Since zswap now writes back pages from memcg-specific LRUs, we now need a new stat to show writebacks count for each memcg. Suggested-by: Nhat Pham Signed-off-by: Domenico Cerasuolo Signed-off-by: Nhat Pham --- include/linux/vm_event_item.h | 1 + mm/memcontrol.c | 1 + mm/vmstat.c | 1 + mm/zswap.c | 3 +++ 4 files changed, 6 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 8abfa1240040..3153359c3841 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -145,6 +145,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, #ifdef CONFIG_ZSWAP ZSWPIN, ZSWPOUT, + ZSWP_WB, #endif #ifdef CONFIG_X86 DIRECT_MAP_LEVEL2_SPLIT, diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2ef49b471a16..e43b5aba8efc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -593,6 +593,7 @@ static const unsigned int memcg_vm_event_stat[] = { #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) ZSWPIN, ZSWPOUT, + ZSWP_WB, #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE THP_FAULT_ALLOC, diff --git a/mm/vmstat.c b/mm/vmstat.c index 359460deb377..5e5572f3b456 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1401,6 +1401,7 @@ const char * const vmstat_text[] = { #ifdef CONFIG_ZSWAP "zswpin", "zswpout", + "zswp_wb", #endif #ifdef CONFIG_X86 "direct_map_level2_splits", diff --git a/mm/zswap.c b/mm/zswap.c index 2654b0d214cc..03ee41a8b884 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -755,6 +755,9 @@ static enum lru_status shrink_memcg_cb(struct list_head *item, struct list_lru_o } zswap_written_back_pages++; + if (entry->objcg) + count_objcg_event(entry->objcg, ZSWP_WB); + /* * Writeback started successfully, the page now belongs to the * swapcache. Drop the entry from zswap - unless invalidate already -- 2.34.1