From: Michal Hocko <mhocko@suse.com>
To: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com,
akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: memcontrol: correct the NR_ANON_THPS counter of hierarchical memcg
Date: Mon, 26 Oct 2020 15:47:57 +0100 [thread overview]
Message-ID: <20201026144757.GJ20500@dhcp22.suse.cz> (raw)
In-Reply-To: <1603722395-72443-1-git-send-email-zhongjiang-ali@linux.alibaba.com>
On Mon 26-10-20 22:26:35, zhongjiang-ali wrote:
> memcg_page_state will get the specified number in hierarchical memcg,
> It should multiply by HPAGE_PMD_NR rather than an page if the item is
> NR_ANON_THPS.
I am not sure which tree are you looking at but the current Linus tree
already does have this hunk.
> Fixes: 468c398233da ("mm: memcontrol: switch to native NR_ANON_THPS counter")
> Signed-off-by: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
> ---
> mm/memcontrol.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3a24e3b..c27898e 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4110,11 +4110,17 @@ static int memcg_stat_show(struct seq_file *m, void *v)
> (u64)memsw * PAGE_SIZE);
>
> for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
> + unsigned long nr;
> +
> if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
> continue;
> + nr = memcg_page_state(memcg, memcg1_stats[i]);
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> + if (memcg1_stats[i] == NR_ANON_THPS)
> + nr *= HPAGE_PMD_NR;
> +#endif
> seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
> - (u64)memcg_page_state(memcg, memcg1_stats[i]) *
> - PAGE_SIZE);
> + nr * PAGE_SIZE);
> }
>
> for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
> --
> 1.8.3.1
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-10-26 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 14:26 zhongjiang-ali
2020-10-26 14:47 ` Johannes Weiner
2020-10-26 14:47 ` Michal Hocko [this message]
2020-10-26 16:31 ` Johannes Weiner
2020-10-26 18:43 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026144757.GJ20500@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=vdavydov.dev@gmail.com \
--cc=zhongjiang-ali@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox