Re: [PATCH 1/6] memcg: use global stat directly for root memcg usage

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

 



(2013/03/12 19:08), Sha Zhengju wrote:
> Since mem_cgroup_recursive_stat(root_mem_cgroup, INDEX) will sum up
> all memcg stats without regard to root's use_hierarchy, we may use
> global stats instead for simplicity.
> 
> Signed-off-by: Sha Zhengju <handai.szj@xxxxxxxxxx>
> ---
>   mm/memcontrol.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 669d16a..735cd41 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4987,11 +4987,11 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
>   			return res_counter_read_u64(&memcg->memsw, RES_USAGE);
>   	}
>   
> -	val = mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_CACHE);
> -	val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_RSS);
> +	val = global_page_state(NR_FILE_PAGES);
> +	val += global_page_state(NR_ANON_PAGES);
>   
you missed NR_ANON_TRANSPARENT_HUGEPAGES

>   	if (swap)
> -		val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_SWAP);
> +		val += total_swap_pages - atomic_long_read(&nr_swap_pages);
>   
Double count mapped SwapCache ? Did you saw Costa's trial in a week ago ?

Thanks,
-Kame


--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux