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 44B19C43334 for ; Mon, 6 Jun 2022 13:30:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 704C86B0073; Mon, 6 Jun 2022 09:30:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 689768D0002; Mon, 6 Jun 2022 09:30:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54E648D0001; Mon, 6 Jun 2022 09:30: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 419326B0073 for ; Mon, 6 Jun 2022 09:30:07 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F3350608F1 for ; Mon, 6 Jun 2022 13:30:06 +0000 (UTC) X-FDA: 79547894412.03.34481F1 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf27.hostedemail.com (Postfix) with ESMTP id C1B1D4003F for ; Mon, 6 Jun 2022 13:30:01 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id e11so12708318pfj.5 for ; Mon, 06 Jun 2022 06:30:05 -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=a6THwbekRoD/OZeM515RpGdmDznAEQ2m0S86eTQP2nM=; b=1/DASdY+kvY8TlD39JuG2crsUbgapeBdNKmyGXcC8hEVF0+ZsqmHt218btZ87BxpUX k765uHjOIiz/IreEUQItmAku9D9qgTnHcO4Ixh2fCyqF+pbbRPv6cK2StQ5L8KIHYOTq Z0W4iO1OWOm0+uF8e9W8wcyRjN1IXWICP59YrmWvZcJ7RakN84CR5I78NDGeRiKsdpnn MPQSKyEXrTfqLVZp5wOk8F3kIUyMNZjaRQ1oDvos8sSPfAFTb8RkCDQbOvKeJIXmyKnB KbiWe3/syU27gCzg2IWL55UQ6wMwgOQ9yHfEbxnCe0m8tpGpWzW+5mVDaSu49CovRs/N RpFQ== 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=a6THwbekRoD/OZeM515RpGdmDznAEQ2m0S86eTQP2nM=; b=kJF0JnHBtD4nng3lnFOJp0uWVJ3+vUHpUZWXJLGRXr8hGgIFQiFpTQOOnasE91IOlo DeL/bnMqvax2tzYIk+Bx9sdXZvE/jzSZji/jZYFmFIdioJf6U+8Mh8fomqSBWv2A6I/2 z41hI36GTPH9pwZVN/qQWvQUsVctzlb2dIKsUPNU9gTDoQ1dvxdexF1oG15GGTdIT4W0 eL0m8d90rRFLzmvASHt0giXxrQ8ByOeznOutYiJFeWda+Bz+SJCf320AA+DIY+85Fp6/ frVEd99nIW/Jl/wtovnhib6ypXXzr7zDBTXOCuoUXsKVBVMJhD0BESaxqOx+Fo/d1UUP TKSg== X-Gm-Message-State: AOAM530bzIqTmECYTVWes3Z1d/mvRwS08Q4eKp3W/DCpZtwkOFZnDmRw x+W8/JZ54FYk6xpLHNGF6rfDiQ== X-Google-Smtp-Source: ABdhPJxPbOJ9HngGe22LmSxuN0462AtcqqoZu6JjvBWF7RcJEYRGvysjzM2D7BIYICUfhv6cokZ8OA== X-Received: by 2002:aa7:9217:0:b0:518:367d:fa85 with SMTP id 23-20020aa79217000000b00518367dfa85mr90933633pfo.9.1654522204614; Mon, 06 Jun 2022 06:30:04 -0700 (PDT) Received: from [10.254.91.102] ([139.177.225.230]) by smtp.gmail.com with ESMTPSA id f10-20020a17090ace0a00b001e31803540fsm10010260pju.6.2022.06.06.06.30.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Jun 2022 06:30:04 -0700 (PDT) Message-ID: Date: Mon, 6 Jun 2022 21:29:58 +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 v2] mm: memcontrol: add {pgscan,pgsteal}_{kswapd,direct} items in memory.stat of cgroup v2 Content-Language: en-US To: Michal Hocko Cc: hannes@cmpxchg.org, roman.gushchin@linux.dev, shakeelb@google.com, songmuchun@bytedance.com, akpm@linux-foundation.org, corbet@lwn.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20220604082209.55174-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-Stat-Signature: bjms9nbp3dwu366ed313zj5jug77fxwc X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="1/DASdY+"; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C1B1D4003F X-HE-Tag: 1654522201-911864 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/6 8:03 PM, Michal Hocko wrote: > On Sat 04-06-22 16:22:09, 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. > > I do not remember why we have chosen to report cumulative stats rather > than the direct and kswapd parts. Looking back when Roman has introduced > those (http://lkml.kernel.org/r/1494530183-30808-1-git-send-email-guro@fb.com) > I do not see any discussion around that. So it was likely just not > a priority. > > I have just one question. Say we even decide to have a per memcg kswapd > in some form, would we report that into the same counter? IMO, I would like it can be reported into the same counter. > >> Signed-off-by: Qi Zheng >> Acked-by: Johannes Weiner >> Acked-by: Roman Gushchin >> Acked-by: Muchun Song > > In any case > Acked-by: Michal Hocko Thanks. > > One nit below > [...] >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >> index 0d3fe0a0c75a..fd78c4d6bbc7 100644 >> --- a/mm/memcontrol.c >> +++ b/mm/memcontrol.c >> @@ -1460,6 +1460,28 @@ static inline unsigned long memcg_page_state_output(struct mem_cgroup *memcg, >> return memcg_page_state(memcg, item) * memcg_page_state_unit(item); >> } >> > > I would just add the following for clarity OK, will do. > > /* Subset of vm_event_item to report for memcg event stats */ >> +static const unsigned int memcg_vm_event_stat[] = { >> + PGSCAN_KSWAPD, >> + PGSCAN_DIRECT, >> + PGSTEAL_KSWAPD, >> + PGSTEAL_DIRECT, >> + PGFAULT, >> + PGMAJFAULT, >> + PGREFILL, >> + PGACTIVATE, >> + PGDEACTIVATE, >> + PGLAZYFREE, >> + PGLAZYFREED, >> +#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) >> + ZSWPIN, >> + ZSWPOUT, >> +#endif >> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE >> + THP_FAULT_ALLOC, >> + THP_COLLAPSE_ALLOC, >> +#endif >> +}; > -- Thanks, Qi