Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4663223rdh; Wed, 29 Nov 2023 07:26:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpW3Hm0vR/uas/atbRdl1t5yuL1/00ACIjogdIQ/5sE1Uk3Pa1boIWQlCJk7bjWBd643ix X-Received: by 2002:a05:6a20:1605:b0:18b:f90d:9d84 with SMTP id l5-20020a056a20160500b0018bf90d9d84mr25803288pzj.54.1701271610237; Wed, 29 Nov 2023 07:26:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701271610; cv=none; d=google.com; s=arc-20160816; b=oHD5oKkoVSTibPhNwE6Q51SXqZW+u+d54zDqrN8SAQmSxSEl/M4LJAfaIn3PmMj4rZ y5IeL694xHtobprlZo9z1BC4+UWwoYJnXF+F9/VK5Rz55fuPq6JKHkYyKVYzvG0bHxWO qNqPPfFOrkMN3EGqHKhB5i1Emfhtm19XKiZhkEdiW1XhXwilmBhX7Va5yiAahRiEsWxe 4jOQ4bqDBl/dEwaxk9F8tbtvVuSsly4/GNiDtq7kuctYujlasmvhGLZ2dQxlymNpwUfd Dpf+vwXvp/0ZAGTEvZA/4iSBOxjuNMgsKyQeLwiEOPL6WkqVS1LCWCqp249Sikgv/1dF W9qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9ggscuLXdkbtAnynY3GdTzeA07chUPA8WGR1vy9vM7w=; fh=dnuTZ7lF+HScHO+ErJYG5fxqkNw/sSQkqUZDMo0Tq8Q=; b=XlBJE3atUZELm8VVmxg6dC83xIEXd4bjwa1Al40GFcmWEVsyP0gDdBw3tDdGYJRR+R saLma2ykrAEZsK4i6T8wEp6t2v4OdO/pe6GrhQ7XLpVb+zqqqpoyJ2TxOrEI8gEyGJRT /pBSnuOz3bD2Txr3xweE3sQumN96IZBeKwaW1IZcfpmsFOk+PHoqJ9ZOmwMQ0Vt9i5ik RC6QpkkxFscI9gVsd+grW00dRV4SVB9lrhftpcAYtHjrFxjRvdav5cN8pJxjjOgFdSq1 D1vrSToqKYwVQMTjIM3ivytLNBSrdYbaO+ZTUPXqZ1kLLBkLzRtJkDWDR40cmIoLdjv1 as9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cH3ZXWk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 9-20020a630b09000000b005b95fbb1745si15226358pgl.562.2023.11.29.07.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 07:26:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cH3ZXWk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D0638809341B; Wed, 29 Nov 2023 07:26:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234988AbjK2PZP (ORCPT + 99 others); Wed, 29 Nov 2023 10:25:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234919AbjK2PZF (ORCPT ); Wed, 29 Nov 2023 10:25:05 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E5CD6E for ; Wed, 29 Nov 2023 07:25:11 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-423a459d616so24912421cf.1 for ; Wed, 29 Nov 2023 07:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1701271511; x=1701876311; darn=vger.kernel.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=9ggscuLXdkbtAnynY3GdTzeA07chUPA8WGR1vy9vM7w=; b=cH3ZXWk2/oyUnIX75QcNokzfI3D4H2OzhpG16aUIyRI1ilDvEcXdf02UICEXQNmIUI FWxTLLy3hDpaNy+ClQPKo1xMP3VkQolaiKPK5mRLtzfT9fTtgk1fGwBlymMihVNujVN2 nrNVvRotEGDL9/Cpf/fpIa+FVp0Xd1Vfo2Fzm7256RPvBmK2cX8AIYD2XZBx0bmWLlfD pZsE2fBA7lh/epk+zywODUzH0FQELz/sMfnyICM5RuebgTeIB0xeIGB61JJttvJ/y6V9 SQL+AqIZNS/aWObRe9LZONObWrppjFF91e3V+kMNWvpzrOL3uobeg7BCzbxO9OACqYJm toXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701271511; x=1701876311; 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=9ggscuLXdkbtAnynY3GdTzeA07chUPA8WGR1vy9vM7w=; b=HcBidEqnfTxdtghh5aU2pR9ICBcIAeWlSqB/wy2Rci8GiOnGMs8jBBrN7B2Qq8K5vt UfFCi78lMtgcuge8Zg7O/37nWP2yHsa5XbYY5ulJD6g5x33VQhXIVA/3zVN6TbveaFYY fy/gn4yHCdSMVgNAMMnM3+muDzd/ru1XoJaNfZYL7S1FhH0aVjuF0+4Mt4RLE0APd2Hd /XLD8xvwSnG4fg4tQC4DIQQlJQSSduffnktOKvEfVM0Pt0vzu9smBa2NbubYzU07qq7M DeYts1ygxBe+VzvnrfpP/XU7Ma/vT+CYUYSZbyuUO7qKeN6Fung15t+pwdntXKsN2RT/ 7jaQ== X-Gm-Message-State: AOJu0YyS5HA4Om00GYzTVTMaR4kJ3dDyWIqoF3nqQ8/7S3qTxaIm2es4 Jj/HvjaVgm8C6CXSqtGka998/w== X-Received: by 2002:ac8:60b:0:b0:423:b632:eaea with SMTP id d11-20020ac8060b000000b00423b632eaeamr11778830qth.8.1701271510969; Wed, 29 Nov 2023 07:25:10 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id t22-20020ac86a16000000b004196d75d79csm5633606qtr.46.2023.11.29.07.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 07:25:10 -0800 (PST) Date: Wed, 29 Nov 2023 10:25:09 -0500 From: Johannes Weiner To: Nhat Pham Cc: akpm@linux-foundation.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: Re: [PATCH v7 4/6] mm: memcg: add per-memcg zswap writeback stat Message-ID: <20231129152509.GD135852@cmpxchg.org> References: <20231127234600.2971029-1-nphamcs@gmail.com> <20231127234600.2971029-5-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231127234600.2971029-5-nphamcs@gmail.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 07:26:22 -0800 (PST) On Mon, Nov 27, 2023 at 03:45:58PM -0800, Nhat Pham wrote: > 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", ZSWPWB and "zswpwb" would match the existing naming scheme a bit better. > #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); > + You need to call count_vm_event() as well, otherwise the /proc/vmstat counter will stay zero.