lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160205153716.GA15544@cmpxchg.org>
Date:	Fri, 5 Feb 2016 10:37:16 -0500
From:	Johannes Weiner <hannes@...xchg.org>
To:	Vladimir Davydov <vdavydov@...tuozzo.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Hocko <mhocko@...nel.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] mm: memcontrol: make tree_{stat,events} fetch all
 stats

On Fri, Feb 05, 2016 at 12:58:21PM +0300, Vladimir Davydov wrote:
> @@ -2745,14 +2745,20 @@ static void tree_events(struct mem_cgroup *memcg, unsigned long *events)
>  
>  static unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
>  {
> -	unsigned long stat[MEMCG_NR_STAT];
> -	unsigned long val;
> +	unsigned long val = 0;
>  
>  	if (mem_cgroup_is_root(memcg)) {
> -		tree_stat(memcg, stat);
> -		val = stat[MEM_CGROUP_STAT_CACHE] + stat[MEM_CGROUP_STAT_RSS];
> -		if (swap)
> -			val += stat[MEM_CGROUP_STAT_SWAP];
> +		struct mem_cgroup *iter;
> +
> +		for_each_mem_cgroup_tree(iter, memcg) {
> +			val += mem_cgroup_read_stat(iter,
> +					MEM_CGROUP_STAT_CACHE);
> +			val += mem_cgroup_read_stat(iter,
> +					MEM_CGROUP_STAT_RSS);
> +			if (swap)
> +				val += mem_cgroup_read_stat(iter,
> +						MEM_CGROUP_STAT_SWAP);
> +		}
>  	} else {
>  		if (!swap)
>  			val = page_counter_read(&memcg->memory);

Looks good to me, thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ