Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp76rdb; Wed, 29 Nov 2023 17:27:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGunncpN9volJlfbGhDtlF/McD3np6SLaD0Ir4+Sg8rqtneQkjNF+L5k/lOeSx2AcGewX60 X-Received: by 2002:a05:6a20:8421:b0:185:876f:4f4d with SMTP id c33-20020a056a20842100b00185876f4f4dmr28620066pzd.32.1701307631764; Wed, 29 Nov 2023 17:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701307631; cv=none; d=google.com; s=arc-20160816; b=amNnNN2nNfd3jqlqFxS6jPZNZveWcOrheMVnjTDu+usRHmb49OYqM964yg2bF/rzfy lqd4FDK3IG7txil7/GOKFwvX2fuwS1gLq2+1klVvM4GNOSEn2i9AnB0ce944Th3X242W 6gW1NIy8Wswtqinypv2EBukCXza7UjdU9I98Ty6GiQggvPN2FCKkEg9bllQluhdr1udL B+JC7LRtOot7RFMyGbT25GTfJr5LUXsZBJB5pIoEdrZ2OLbScRXNRh5GhncwstvTnmVn OHzS1VIQvHYSMv5yFiGh9JkawimeJnMSB5Xn9iDqaOfRVRz0Evdq/aQrUbNGQ8J3GXuO 3qjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bAYD5IjaIlcnamI/OXacp/VY9pjlnxPbgUDraWeIFVQ=; fh=CQe3bLE0SvRazpTPupXM0NE1aafNrdD0FdNEToDOM4E=; b=vPyH37x9eXQUvqcvCTI9J6DpQRX0lubrZwrrgt3JbvXKE6/RKbRYB0nd85khkv7Anb PuwuZJbiJ0B1BxaIl+3if63DqbngDbN3XSGXn4mqYQp8cWr4fV1d5eFxQwzgy8IEdZNu ZAPrpCe6huuY1TbowOm0TCzNJa0zDmV74zBY6KCcRyLaMWJpGpAzXPMQtgLeJVIfjitP tZMS9R9klwNZyRr0adHV4SuxV0uBGNKGEHzGUf3VzcnXdJt3M9vbJumM7u7Pu5U48V8p ke5IWyNGG82KoFPr3JXm0CjvJWCebBAKM9FrIc430VFV2xgmYUrbMedFGpCaG6E5RrEh qOLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l1xiFnKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id w38-20020a631626000000b005b93bfe91f3si128454pgl.577.2023.11.29.17.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 17:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l1xiFnKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 09B41804BC3A; Wed, 29 Nov 2023 17:27:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343963AbjK3B0m (ORCPT + 99 others); Wed, 29 Nov 2023 20:26:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbjK3B0l (ORCPT ); Wed, 29 Nov 2023 20:26:41 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D4010C3; Wed, 29 Nov 2023 17:26:47 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-35c617c9e73so930935ab.1; Wed, 29 Nov 2023 17:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701307606; x=1701912406; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bAYD5IjaIlcnamI/OXacp/VY9pjlnxPbgUDraWeIFVQ=; b=l1xiFnKqcPrRbQrAar0/jISBsvpfi8Tl39rcpJv8drEMpKI3BLXB33i6Bcw68ESZUC S3B69l7PUXaF8NTZX+OpZ7J/pu00Q5kL2/pUOi60CLa/mTQrNMq7x0/VOhm78NjtKP04 qifDHUKX4A6i/rEOx124HeXAXmBCxl03S3vpPqnD7eTA6K9iMrTgGArqw05VLJfTy8wT M294b/jxs5gAWLuaeG83iagLZUO50VQojADYkdfp1YSjB8grIyPp7UZpIPBEpJg0Rn/T S11/PGC714K2rKmIEsgT9Gv4xgAQySUosxRASOueBeCCcwezLhLQ48gxeFIFz4atIemd dsWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701307606; x=1701912406; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bAYD5IjaIlcnamI/OXacp/VY9pjlnxPbgUDraWeIFVQ=; b=h0+QqMn/m643twAfY6TfwEKfEAPAbG3PK+OVlI27T+UdOlgYWd2EaW7v/Ga3gMGIAe UyLRes8aQ3q/BnpWVW9cheFld7uQmAh0X+ccuiGldfjWjnky/gV/Iy4zAF8mKXdw+ToT 6Vb3dC/X3/XEdSj1ORwQTqTWLWEtViRwXBp+f0V9lsbUCaOfVzO0fEXthWYR9AHLqPph Fko7L4FnnysPaoRKp88yeP+XjYm6kv+F/NjOBKlV6cqc65n1cuuUSqFIgqhM57r8IKtv V/hoFa5ESuFH8IhYSAV6Ym+oAti8cVLyaOJZUSXgE7Y/Dg4UXey4IswLW8zj282eg67n 8Svw== X-Gm-Message-State: AOJu0Yyhg3nOABOLTqHu9DHxvlCqOvxxwk4pwEn2DPtqZxggf4WbzNXO b933+pn51Hkbn25KB5VeLG8qJ7Lm0EElZquLEbw= X-Received: by 2002:a92:4b02:0:b0:35c:d630:8c9a with SMTP id m2-20020a924b02000000b0035cd6308c9amr13585997ilg.28.1701307606540; Wed, 29 Nov 2023 17:26:46 -0800 (PST) MIME-Version: 1.0 References: <20231127234600.2971029-1-nphamcs@gmail.com> <20231127234600.2971029-5-nphamcs@gmail.com> <20231129152509.GD135852@cmpxchg.org> In-Reply-To: <20231129152509.GD135852@cmpxchg.org> From: Nhat Pham Date: Wed, 29 Nov 2023 17:26:35 -0800 Message-ID: Subject: Re: [PATCH v7 4/6] mm: memcg: add per-memcg zswap writeback stat To: Johannes Weiner 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 17:27:05 -0800 (PST) On Wed, Nov 29, 2023 at 7:25=E2=80=AFAM Johannes Weiner wrote: > > 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_ite= m.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, PSWPO= UT, > > #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[] =3D= { > > #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[] =3D { > > #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. Ahh I didn't check that. I only looked at the cgroup's memory.stat counter. I'll fix this for v8!