Re: [PATCH] mm: memcontrol: correct the NR_ANON_THPS counter of hierarchical memcg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
> ---
>  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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux