From mboxrd@z Thu Jan 1 00:00:00 1970 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 EA372C433EF for ; Mon, 6 Jun 2022 17:35:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28A3D6B0071; Mon, 6 Jun 2022 13:35:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 238FE8D0001; Mon, 6 Jun 2022 13:35:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12AEF6B0074; Mon, 6 Jun 2022 13:35:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 01D3F6B0071 for ; Mon, 6 Jun 2022 13:35:06 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C037234F8E for ; Mon, 6 Jun 2022 17:35:06 +0000 (UTC) X-FDA: 79548511812.07.57DCD48 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf19.hostedemail.com (Postfix) with ESMTP id 4F7C11A0022 for ; Mon, 6 Jun 2022 17:34:49 +0000 (UTC) Received: by mail-qv1-f47.google.com with SMTP id i19so10656756qvu.13 for ; Mon, 06 Jun 2022 10:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ONtgrpUVfgaDiq1zXnbAn6nVrL5RzEEKdEEOpv/ts/w=; b=RPfBncwo3xRZLwPCaB9JoOSmhUbJjQWh9/5exDp/xTLykz+3iQC2crnSEzJTjWyngW IO+Uunz+rAz2cBH+5mqRSxNUA0mo50556+qYwskvrDKYj/86Oh7U1tHDmYc0kL4XFimb 28/h/wWggvQUJvn+QDFC8qSqgypcW8OXO5p8MCzEzNPUvxnnLpYDMlj5rkMrpLW2GJpF XTzyw1Tx3zPSOsULoI+qZ6DwI6rqRiepjm29aGw7avud7eFNPacK0xOxx8hAb4XLaw+Y 7B8tg2GZowlAXWZzUhqt/D3u3E+cr/E7Y6CMu+HqfRt7RFUgXIsF9idwf8un6kTDs60i IAKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ONtgrpUVfgaDiq1zXnbAn6nVrL5RzEEKdEEOpv/ts/w=; b=CvL6s7pPJHsFU9rz59RtHhDm1E87HidT6oRYmMXrR2hun732ReGR5VHGYO0mdNf84O NQrj0cu3QSfoOpjJc2Fi5qsfGeqMwVS3nByPAUQAoN+TsLYRTmmg9TX2RvVAlWxLTpOB WA/ZTPJrV3I8dXSo7QQi1lDVizgf3apoTuQUmN0z8g+dUvSMu70Vs2eL/S9NN50hrgu/ /fZJgNY3w1iZhK0koxfAVfZ4xT+kH1SVsP9tAwc0HMkDZP6tBDP+Vgv8AQ5LiN0bY0vW wuoPBEkTJ9Kvwuriz1ZWphAfbfpzLdihmw8fqicnHqIuY2QYrjXge/RTCd2YEtXNQ8CY qf4w== X-Gm-Message-State: AOAM533PYXjoOcYvHmMx42YV+sDNL66CvfGEJnFypPlnHNyo0u56awiI Z7b1Dk32VA00W1U15zvD3DO+LQ== X-Google-Smtp-Source: ABdhPJwHrpLRvcb2wRgm9WoukfE/nzu+lokhq+WkPqXduzdXyYjlDQJX7ghcMowYgUkJL1HDosduPQ== X-Received: by 2002:a05:6214:1d2f:b0:464:46fe:ca68 with SMTP id f15-20020a0562141d2f00b0046446feca68mr34363805qvd.4.1654536905279; Mon, 06 Jun 2022 10:35:05 -0700 (PDT) Received: from localhost (cpe-67-251-217-1.hvc.res.rr.com. [67.251.217.1]) by smtp.gmail.com with ESMTPSA id g4-20020a37b604000000b006a5fb8219bbsm11805833qkf.44.2022.06.06.10.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 10:35:04 -0700 (PDT) Date: Mon, 6 Jun 2022 13:34:59 -0400 From: Johannes Weiner To: Qi Zheng Cc: roman.gushchin@linux.dev, shakeelb@google.com, songmuchun@bytedance.com, mhocko@kernel.org, akpm@linux-foundation.org, corbet@lwn.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Michal Hocko Subject: Re: [PATCH v3] mm: memcontrol: add {pgscan,pgsteal}_{kswapd,direct} items in memory.stat of cgroup v2 Message-ID: References: <20220606154028.55030-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606154028.55030-1-zhengqi.arch@bytedance.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4F7C11A0022 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=RPfBncwo; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf19.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.47 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Stat-Signature: u9119smqnsofi19rifkz8pamen6j5jyu X-Rspam-User: X-HE-Tag: 1654536889-910455 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 06, 2022 at 11:40:28PM +0800, Qi Zheng wrote: > There are already statistics of {pgscan,pgsteal}_kswapd and > {pgscan,pgsteal}_direct of memcg event here, but now only the > sum of the two is displayed in memory.stat of cgroup v2. > > In order to obtain more accurate information during monitoring > and debugging, and to align with the display in /proc/vmstat, > it better to display {pgscan,pgsteal}_kswapd and > {pgscan,pgsteal}_direct separately. > > Also, for forward compatibility, we still display pgscan and > pgsteal items so that it won't break existing applications. > > Signed-off-by: Qi Zheng > Acked-by: Johannes Weiner > Acked-by: Roman Gushchin > Acked-by: Muchun Song > Acked-by: Shakeel Butt > Acked-by: Michal Hocko No objection to keeping pgscan and pgsteal, but can you please fix the doc to present the items in the same order as memory.stat has them? > @@ -1445,9 +1445,21 @@ PAGE_SIZE multiple when read back. > pgscan (npn) > Amount of scanned pages (in an inactive LRU list) > > + pgscan_kswapd (npn) > + Amount of scanned pages by kswapd (in an inactive LRU list) > + > + pgscan_direct (npn) > + Amount of scanned pages directly (in an inactive LRU list) > + > pgsteal (npn) > Amount of reclaimed pages > > + pgsteal_kswapd (npn) > + Amount of reclaimed pages by kswapd > + > + pgsteal_direct (npn) > + Amount of reclaimed pages directly > + > pgactivate (npn) > Amount of pages moved to the active LRU list vs: > @@ -1495,41 +1518,17 @@ static char *memory_stat_format(struct mem_cgroup *memcg) > } > > /* Accumulated memory events */ > - > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGFAULT), > - memcg_events(memcg, PGFAULT)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGMAJFAULT), > - memcg_events(memcg, PGMAJFAULT)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGREFILL), > - memcg_events(memcg, PGREFILL)); > seq_buf_printf(&s, "pgscan %lu\n", > memcg_events(memcg, PGSCAN_KSWAPD) + > memcg_events(memcg, PGSCAN_DIRECT)); > seq_buf_printf(&s, "pgsteal %lu\n", > memcg_events(memcg, PGSTEAL_KSWAPD) + > memcg_events(memcg, PGSTEAL_DIRECT)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGACTIVATE), > - memcg_events(memcg, PGACTIVATE)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGDEACTIVATE), > - memcg_events(memcg, PGDEACTIVATE)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGLAZYFREE), > - memcg_events(memcg, PGLAZYFREE)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(PGLAZYFREED), > - memcg_events(memcg, PGLAZYFREED)); > - > -#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(ZSWPIN), > - memcg_events(memcg, ZSWPIN)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(ZSWPOUT), > - memcg_events(memcg, ZSWPOUT)); > -#endif > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(THP_FAULT_ALLOC), > - memcg_events(memcg, THP_FAULT_ALLOC)); > - seq_buf_printf(&s, "%s %lu\n", vm_event_name(THP_COLLAPSE_ALLOC), > - memcg_events(memcg, THP_COLLAPSE_ALLOC)); > -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > + for (i = 0; i < ARRAY_SIZE(memcg_vm_event_stat); i++) > + seq_buf_printf(&s, "%s %lu\n", > + vm_event_name(memcg_vm_event_stat[i]), > + memcg_events(memcg, memcg_vm_event_stat[i])); Thanks