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 631A9C43334 for ; Tue, 7 Jun 2022 02:18:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F2826B0072; Mon, 6 Jun 2022 22:18:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57C666B0073; Mon, 6 Jun 2022 22:18:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F4D86B0074; Mon, 6 Jun 2022 22:18:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 29DE56B0072 for ; Mon, 6 Jun 2022 22:18:43 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EACB1968 for ; Tue, 7 Jun 2022 02:18:42 +0000 (UTC) X-FDA: 79549831284.19.F71E30F Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf02.hostedemail.com (Postfix) with ESMTP id E119E80025 for ; Tue, 7 Jun 2022 02:18:34 +0000 (UTC) Received: by mail-pg1-f174.google.com with SMTP id c18so6169996pgh.11 for ; Mon, 06 Jun 2022 19:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=8sGOsf30AB4emDfiLKO1IlUk0AJkLgR+c81RM9kvUeg=; b=23/xn5mUfnbRHw/7rzRolDNvBoA3vJ8Zvi5YH/mMPizfXZRAqEGf1K2xd6h65uCw4B X336gShgxmAzPAqaJyWEXrCo8MaNXGdWVSlPDYLLYyHiCe6iRJBF8jRYyqzCCfWoqqmj Skc6vJCfA/ocFu2mF/RGBfAzkGNiEW/theV44cARZCzxymjqugvtHvvl6bh11PrGg2JD Gy7+kggYxEVh7g28/P5Pjwbeo++DZR6ZYx6g9f8hpIKjN8YRsiM5vMiInKE3rYSewx9A ha22E+aJwCOyd1KWeuki+SPV96uIJXHmXszYv96vQ57TqakvebXz/0msJW5VEt7ai04y k1CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=8sGOsf30AB4emDfiLKO1IlUk0AJkLgR+c81RM9kvUeg=; b=ujOL2NeOzZVbSJ7whdXI9HgBzHpC2r2YHdJwNBvVGNNXy+kTJ7utZp50qYMN54KvCY bjV6ZW3JWcVjunSx75sRqMKmgVZHGNl94stf1ewmL1nIdyzp3Px4D2ioVT+Xd8B7SwT/ PBwZC+C21IkvFm49VlvI2xUQVX9Hjjezv+RCn3ejZRMAraU1yyVlaeULAffVBwckcXq0 rc/Rn1vv+RiN+jIwnraK9cW4L3cg7IVBmQMylXWSxmE33H188H+I1FDcezK4TNprMLq9 p6N4lKkRYVzMX+a81i7ZNiMlMRVXgc0l8TuFVl6S1XOXXdmzeOnzTyfz3F7Vo2bOyw8C C2Tg== X-Gm-Message-State: AOAM532Q5x+rAVDeYF6jT8UYRutZz7xQOqBnCwQrN/wN0Ocsp7GI2NpN HlERl8K+THETdwDLpCpILH/FMw== X-Google-Smtp-Source: ABdhPJzd5ZXvpWQ60IJGhalL0hOrDsUY1cmxQggKtjiWvLvBXtomKJRxIhxHb/4bKYIiG3S3A79cLg== X-Received: by 2002:a63:8941:0:b0:3fc:7efa:119d with SMTP id v62-20020a638941000000b003fc7efa119dmr23916764pgd.340.1654568320532; Mon, 06 Jun 2022 19:18:40 -0700 (PDT) Received: from [10.254.91.102] ([139.177.225.230]) by smtp.gmail.com with ESMTPSA id ju10-20020a17090b20ca00b001df264610c4sm13930080pjb.0.2022.06.06.19.18.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Jun 2022 19:18:40 -0700 (PDT) Message-ID: <64d93544-294b-6149-524d-f7ce227d7e33@bytedance.com> Date: Tue, 7 Jun 2022 10:18:33 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3] mm: memcontrol: add {pgscan,pgsteal}_{kswapd,direct} items in memory.stat of cgroup v2 Content-Language: en-US To: Johannes Weiner 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 References: <20220606154028.55030-1-zhengqi.arch@bytedance.com> From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="23/xn5mU"; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E119E80025 X-Stat-Signature: cqkqeghtyg7d7x9xcbd7cp884kbjm3hy X-HE-Tag: 1654568314-342981 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 2022/6/7 1:34 AM, Johannes Weiner wrote: > 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? Sure, will fix. Thanks, Qi > >> @@ -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 -- Thanks, Qi