Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3479243rdh; Mon, 27 Nov 2023 15:46:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IG37XN/AACNSpxHHp/Wmvb6K8TPtmV0w/0E8e2i+gBaK7nZRasbhxmSp1kkpwvUD0zWoMH0 X-Received: by 2002:a17:90b:1b01:b0:285:a0de:c726 with SMTP id nu1-20020a17090b1b0100b00285a0dec726mr8265607pjb.35.1701128795348; Mon, 27 Nov 2023 15:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701128795; cv=none; d=google.com; s=arc-20160816; b=YXwx5cBg8fuo0JjsvyTheuJ9FMdDdNHsaDbkc0YxcRy5EiaApQl4UNIu4ARM2Jf/Z2 dUhXzEPVIUeivO3Nwa4TSktNVaXCEFuyqpSC6xM/ucXj7GRcq8+Y/agAkIJkOAzHiVpB sUyDTsrvUDTUaBEM85Rrf5sPsPg2eU/7t1PQi7v8J9Cx5oA1aFKo3PcJNYzCqOgfnIKS gF4QkJQ4N+ic8/Yd3h9N7PHHKLfzLsnqI1hKOIrOPPYQIBbxiOm8ppNRgFIHOT4nd5Mt 6QEiQOO21WvdH1HHnkHLUhvCxmjN/tyduLkM+dDMHpar347nmRubfpFwsgQQV3M9lgky kXxg== 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=+QqTttvrK+ydHCThErTWQGU78pwuFOyKaqUvf3Lt6j8=; fh=5ynFD2G6LA0fdRuAOSZxbBxHoIIG4U3xrwbnkupZs28=; b=FmOWQirntNkUDekBU+SDEXpo6PwwAzut1tjZERNqjiq9FInibKP4aY7kOZ2KBc+AU2 xWM+sbPMDzfa+O5F/CX63ltwSbxQlsE0mD0xorFp1/zrx74dWULr1M/Oc1UkWC3gvI9O 0WO9cOboyNaYlJnEexzl9VMVS+989BZUBxaIMTL42nmNGnrJ4w0yioI7c+B193Sp36r9 agjO8frA06rmP5AElAYt5t1k1/0r6TwXmf1dqP7vVcIs4HynFOYWe5K/PnUw193W7EPA uz1Pt8ci3M9hi//DMx067rUyMSSZlHc+y5bLn2vM/C2y1bfih2CDTDnbWkRrxyXMaoei R9ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NrHaEoiI; 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 go17-20020a17090b03d100b00276571c0d34si10394123pjb.6.2023.11.27.15.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 15:46:35 -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=NrHaEoiI; 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 914368051B6A; Mon, 27 Nov 2023 15:46:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233895AbjK0XqS (ORCPT + 99 others); Mon, 27 Nov 2023 18:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbjK0XqA (ORCPT ); Mon, 27 Nov 2023 18:46:00 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19EB1B1; Mon, 27 Nov 2023 15:46:05 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5c2066accc5so3253232a12.3; Mon, 27 Nov 2023 15:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701128765; x=1701733565; 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=+QqTttvrK+ydHCThErTWQGU78pwuFOyKaqUvf3Lt6j8=; b=NrHaEoiIGzswpw48UOOMgSE/w6JjfTItR35NDtUcjjGzgm4yBvBYHpIcoENC9fMcvp AdtPmEOGjksixBn1UqcKUyKFDtZxKMCFuWy07Pd+HDiMjc+e/VfXDPELs5MLEhOhA5hR kEj8EwHC2agx1EHc4vVNFx96OyjlvwqskFw5+kfGE0SG5CACgLAW5sf2rfSyKS73e+XR ZpWRAtF2ywuDXO6vv7VctR06WGcm/2ODALmWT8SY/NJmc0/xPAS+clrClkeQCddAZzdR 7r5RR7/V8gcbcwzHs8GdnI+Y65EGLMjLfEJxj3JxzKmA2iA0Z4TXzQPkJ0E2jHXxuhYO /kcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701128765; x=1701733565; 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=+QqTttvrK+ydHCThErTWQGU78pwuFOyKaqUvf3Lt6j8=; b=a18pdayLB7pcOUSsXC4Bcm0KY8B9vP7SFjOro0ceqZ8hbN4NyaMl44qgW1hjalatCy iSnTJbCqOyLXW0xbBrlrmP8NPmRosSG/AJ6pABQw/yjS39ii5Ld+XJq2POZ94jBLFZ7e 23mKTU9dSwRxPLpz8FQ7K3d9yWVTSUAuyIbpPROIbx2rvhJv2Va7L8bZVvVbiNkbHj53 0x/PWNOI8I4ui3m3TGkH4mbXZssUJBLmwvn6UyS0RuDJcITN97+SvuF5S+54PfjILT+A rkwYuxMxM/ZGrYYs92KE3UwLHejGK2GtMY2e4f+eE4710OG7nqB0hzP1puHt8zlttqD5 /ZWQ== X-Gm-Message-State: AOJu0YxhsnthAwX9FnAQ5Mx51t5WhOkTOUhdhqDH0ij/jZw6OpD1J1bZ Qw8uNfvaJW/d4vmLZJv42Pk= X-Received: by 2002:a17:90b:4d06:b0:27c:f9e7:30fd with SMTP id mw6-20020a17090b4d0600b0027cf9e730fdmr12623338pjb.7.1701128765215; Mon, 27 Nov 2023 15:46:05 -0800 (PST) Received: from localhost (fwdproxy-prn-116.fbsv.net. [2a03:2880:ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id 25-20020a17090a031900b0027d0af2e9c3sm9103232pje.40.2023.11.27.15.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 15:46: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 v7 4/6] mm: memcg: add per-memcg zswap writeback stat Date: Mon, 27 Nov 2023 15:45:58 -0800 Message-Id: <20231127234600.2971029-5-nphamcs@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231127234600.2971029-1-nphamcs@gmail.com> References: <20231127234600.2971029-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_NONE,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, 27 Nov 2023 15:46:32 -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 d1b847502f09..f4569ad98edf 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -142,6 +142,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 8c0f3f971179..f88c8fd03689 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -703,6 +703,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 afa5a38fcc9c..2249f85e4a87 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 5e397fc1f375..6a761753f979 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -754,6 +754,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